~pixelherodev/zyg

fe733ff3fd2f9d584145217a7124e001e9bce498 — Noam Preil 8 months ago e3dd680
p9: switch tests to test/executor.c
2 files changed, 14 insertions(+), 45 deletions(-)

M mkfile
M test/executor.c
M mkfile => mkfile +9 -44
@@ 5,6 5,15 @@ all:V: $O.out.zyg
$O.out.zyg: driver.$O parser.$O lexer.$O queue.$O sema.$O lib/z80e/registers.$O lib/z80e/cpu.$O lib/z80e/log.$O tokens.$O
	pcc -o $target $prereq -l9 -lc3

test/executor.bin: test/executor.$O
	pcc -o $target $prereq -lc3 -l9

testall: test/executor.bin
	./test/executor.bin `{walk -f ./test/ | sed 's$^$./$' | grep '\.zig$'}

test/%.bin: test/%.zig $O.out.zyg
	./$O.out.zyg ./test/$stem.zig --test -c -o $target

install:V: /$objtype/bin/zyg

/$objtype/bin/zyg: $O.out.zyg


@@ 25,47 34,3 @@ clean:
usage/%:QV: $O.out.zyg
	$prereq --debug usage test/$stem.zig

test/%:QV: $O.out.zyg
	$prereq -S $target.zig

testall:VQ:
	if(@{walk test | grep -e '\.zig$' ; echo} | while(case=`{read}){
		if(~ $#case 0)
			exit
		if(! @{
			succeed=1
			name=`{echo $case | sed -e 's$^test/$$' -e 's/\.zig$//'}
			cat test/broken | while(ignore=`{read})
				if(~ $name $ignore)
					exit
			if(! @{
				cat test/failing | while(ignore=`{read}){
					ignore=`{echo $ignore | sed 's/:.*//'}
					if(~ $name $ignore)
						exit fail
				}
				exit 0
			})
				succeed=0
			if(! mk test/$name){
				if(~ $succeed 1){
					echo [FAIL] $case
					exit failure
				}
				if not {
					echo [EXPECT_FAIL] $case `{cat test/failing | grep '^'^$name^':'}
					exit
				}
			}
			if(~ $succeed 1){
				echo [PASS] $case
			}
			if not{
				echo [UNEXPECTED_PASS] $case `{cat test/failing | grep '^'^$name^':'}
				exit failure
			}
		})
			exit failure
	})
		echo all tests passed


M test/executor.c => test/executor.c +5 -1
@@ 85,7 85,11 @@ pexec(char *cmd, char **out)
static int
testcompile(void)
{
#ifdef _PLAN9_SOURCE
	char *cmd = aprintf("mk >[2=1] %s", state.test.binpath);
#else
	char *cmd = aprintf("make --no-print-directory 2>&1  %s", state.test.binpath);
#endif
	char *out = NULL;
	int status = pexec(cmd, &out);
	free(cmd);


@@ 153,7 157,7 @@ main(int argc, char **argv)
{
	char *buf;
	int i;
	if(argc < 3)
	if(argc < 2)
		FATAL_EXIT("%s", usage);
	state.failed = 0;
	state.succeeded = 0;