tests2: cleanup
- remove -norunsrc switch
Meaning and usage (-run -norun...???) look sort of screwed. Also
general usefulness is unclear, so it was actually to support exactly
one (not even very interesting) test
This partially reverts e31579b076
This commit is contained in:
parent
76accfb8d5
commit
f90bad0925
5 changed files with 26 additions and 32 deletions
7
libtcc.c
7
libtcc.c
|
@ -1666,7 +1666,6 @@ enum {
|
||||||
TCC_OPTION_pedantic,
|
TCC_OPTION_pedantic,
|
||||||
TCC_OPTION_pthread,
|
TCC_OPTION_pthread,
|
||||||
TCC_OPTION_run,
|
TCC_OPTION_run,
|
||||||
TCC_OPTION_norunsrc,
|
|
||||||
TCC_OPTION_v,
|
TCC_OPTION_v,
|
||||||
TCC_OPTION_w,
|
TCC_OPTION_w,
|
||||||
TCC_OPTION_pipe,
|
TCC_OPTION_pipe,
|
||||||
|
@ -1709,7 +1708,6 @@ static const TCCOption tcc_options[] = {
|
||||||
{ "pedantic", TCC_OPTION_pedantic, 0},
|
{ "pedantic", TCC_OPTION_pedantic, 0},
|
||||||
{ "pthread", TCC_OPTION_pthread, 0},
|
{ "pthread", TCC_OPTION_pthread, 0},
|
||||||
{ "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
{ "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
||||||
{ "norunsrc", TCC_OPTION_norunsrc, 0 },
|
|
||||||
{ "rdynamic", TCC_OPTION_rdynamic, 0 },
|
{ "rdynamic", TCC_OPTION_rdynamic, 0 },
|
||||||
{ "r", TCC_OPTION_r, 0 },
|
{ "r", TCC_OPTION_r, 0 },
|
||||||
{ "s", TCC_OPTION_s, 0 },
|
{ "s", TCC_OPTION_s, 0 },
|
||||||
|
@ -1748,7 +1746,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||||
const TCCOption *popt;
|
const TCCOption *popt;
|
||||||
const char *optarg, *r;
|
const char *optarg, *r;
|
||||||
int run = 0;
|
int run = 0;
|
||||||
int norunsrc = 0;
|
|
||||||
int pthread = 0;
|
int pthread = 0;
|
||||||
int optind = 0;
|
int optind = 0;
|
||||||
|
|
||||||
|
@ -1761,7 +1758,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||||
r = argv[optind++];
|
r = argv[optind++];
|
||||||
if (r[0] != '-' || r[1] == '\0') {
|
if (r[0] != '-' || r[1] == '\0') {
|
||||||
/* add a new file */
|
/* add a new file */
|
||||||
if (!run || !norunsrc)
|
|
||||||
dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r));
|
dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r));
|
||||||
if (run) {
|
if (run) {
|
||||||
optind--;
|
optind--;
|
||||||
|
@ -1888,9 +1884,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
|
||||||
tcc_set_options(s, optarg);
|
tcc_set_options(s, optarg);
|
||||||
run = 1;
|
run = 1;
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_norunsrc:
|
|
||||||
norunsrc = 1;
|
|
||||||
break;
|
|
||||||
case TCC_OPTION_v:
|
case TCC_OPTION_v:
|
||||||
do ++s->verbose; while (*optarg++ == 'v');
|
do ++s->verbose; while (*optarg++ == 'v');
|
||||||
break;
|
break;
|
||||||
|
|
1
tcc.c
1
tcc.c
|
@ -69,7 +69,6 @@ static void help(void)
|
||||||
" -Bdir use 'dir' as tcc internal library and include path\n"
|
" -Bdir use 'dir' as tcc internal library and include path\n"
|
||||||
" -MD generate target dependencies for make\n"
|
" -MD generate target dependencies for make\n"
|
||||||
" -MF depfile put generated dependencies here\n"
|
" -MF depfile put generated dependencies here\n"
|
||||||
" -norunsrc Do not compile the file which is the first argument after -run.\n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ int main(int argc, char **argv)
|
||||||
int Count;
|
int Count;
|
||||||
|
|
||||||
printf("hello world %d\n", argc);
|
printf("hello world %d\n", argc);
|
||||||
for (Count = 0; Count < argc; Count++)
|
for (Count = 1; Count < argc; Count++)
|
||||||
printf("arg %d: %s\n", Count, argv[Count]);
|
printf("arg %d: %s\n", Count, argv[Count]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
hello world 6
|
hello world 6
|
||||||
arg 0: 31_args.c
|
arg 1: arg1
|
||||||
arg 1: -
|
arg 2: arg2
|
||||||
arg 2: arg1
|
arg 3: arg3
|
||||||
arg 3: arg2
|
arg 4: arg4
|
||||||
arg 4: arg3
|
arg 5: arg5
|
||||||
arg 5: arg4
|
|
||||||
|
|
|
@ -46,9 +46,11 @@ TESTS = \
|
||||||
27_sizeof.test \
|
27_sizeof.test \
|
||||||
28_strings.test \
|
28_strings.test \
|
||||||
29_array_address.test \
|
29_array_address.test \
|
||||||
|
30_hanoi.test \
|
||||||
31_args.test \
|
31_args.test \
|
||||||
32_led.test \
|
32_led.test \
|
||||||
33_ternary_op.test \
|
33_ternary_op.test \
|
||||||
|
34_array_assignment.test \
|
||||||
35_sizeof.test \
|
35_sizeof.test \
|
||||||
36_array_initialisers.test \
|
36_array_initialisers.test \
|
||||||
37_sprintf.test \
|
37_sprintf.test \
|
||||||
|
@ -60,6 +62,7 @@ TESTS = \
|
||||||
43_void_param.test \
|
43_void_param.test \
|
||||||
44_scoped_declarations.test \
|
44_scoped_declarations.test \
|
||||||
45_empty_for.test \
|
45_empty_for.test \
|
||||||
|
46_grep.test \
|
||||||
47_switch_return.test \
|
47_switch_return.test \
|
||||||
48_nested_break.test \
|
48_nested_break.test \
|
||||||
49_bracket_evaluation.test \
|
49_bracket_evaluation.test \
|
||||||
|
@ -81,31 +84,31 @@ TESTS = \
|
||||||
# 34_array_assignment.test -- array assignment is not in C standard
|
# 34_array_assignment.test -- array assignment is not in C standard
|
||||||
# 46_grep.test -- does not compile even with gcc
|
# 46_grep.test -- does not compile even with gcc
|
||||||
|
|
||||||
|
SKIP = 30_hanoi.test 34_array_assignment.test 46_grep.test
|
||||||
|
|
||||||
# some tests do not pass on all platforms, remove them for now
|
# some tests do not pass on all platforms, remove them for now
|
||||||
ifeq ($(TARGETOS),Darwin)
|
ifeq ($(TARGETOS),Darwin)
|
||||||
TESTS := $(filter-out 40_stdio.test,$(TESTS))
|
SKIP += 40_stdio.test
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_WIN32
|
ifdef CONFIG_WIN32
|
||||||
TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS))
|
SKIP += 24_math_library.test # don't have round()
|
||||||
|
SKIP += 28_strings.test # don't have r/index() / strings.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Some tests might need arguments
|
||||||
|
ARGS =
|
||||||
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
||||||
|
|
||||||
|
all test: $(filter-out $(SKIP),$(TESTS))
|
||||||
|
|
||||||
%.test: %.c %.expect
|
%.test: %.c %.expect
|
||||||
@echo Test: $*...
|
@echo Test: $*...
|
||||||
@if [ "x`echo $* | grep args`" != "x" ]; \
|
|
||||||
then $(TCC) $< -norunsrc -run $(notdir $<) - arg1 arg2 arg3 arg4 >$*.output 2>&1; \
|
|
||||||
else $(TCC) -run $< >$*.output 2>&1; \
|
|
||||||
($(TCC) -o $*.exe $< && ./$*.exe) >$*.output2 2>&1; \
|
|
||||||
fi || true
|
|
||||||
@if diff -bu $(<:.c=.expect) $*.output ; \
|
|
||||||
then rm -f $*.output; \
|
|
||||||
else exit 1; \
|
|
||||||
fi
|
|
||||||
@if test -f $*.output2; then if diff -bu $(<:.c=.expect) $*.output2 ; \
|
|
||||||
then rm -f $*.output2; \
|
|
||||||
else exit 1; \
|
|
||||||
fi; fi
|
|
||||||
|
|
||||||
all test: $(TESTS)
|
@$(TCC) -run $< $(ARGS) >$*.output 2>&1 || true
|
||||||
|
@diff -bu $*.expect $*.output && rm -f $*.output
|
||||||
|
|
||||||
|
@($(TCC) $< -o $*.exe && ./$*.exe $(ARGS)) >$*.output2 2>&1 || true
|
||||||
|
@diff -bu $*.expect $*.output2 && rm -f $*.output2 $*.exe
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf fred.txt *.output* *.exe
|
rm -vf fred.txt *.output* *.exe
|
||||||
|
|
Loading…
Reference in a new issue