- 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 e31579b0769e1f9c0947d12e83316d1149307b1a
Unified · Split
| @@ -1666,7 +1666,6 @@ enum { · 1665 unmodified lines | ||
| 1666 | 1666 | TCC_OPTION_pedantic, |
| 1667 | 1667 | TCC_OPTION_pthread, |
| 1668 | 1668 | TCC_OPTION_run, |
| 1669 | − TCC_OPTION_norunsrc, | |
| 1670 | 1669 | TCC_OPTION_v, |
| 1671 | 1670 | TCC_OPTION_w, |
| 1672 | 1671 | TCC_OPTION_pipe, |
| @@ -1709,7 +1708,6 @@ static const TCCOption tcc_options[] = { · 36 unmodified lines | ||
| 1709 | 1708 | { "pedantic", TCC_OPTION_pedantic, 0}, |
| 1710 | 1709 | { "pthread", TCC_OPTION_pthread, 0}, |
| 1711 | 1710 | { "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, |
| 1712 | − { "norunsrc", TCC_OPTION_norunsrc, 0 }, | |
| 1713 | 1711 | { "rdynamic", TCC_OPTION_rdynamic, 0 }, |
| 1714 | 1712 | { "r", TCC_OPTION_r, 0 }, |
| 1715 | 1713 | { "s", TCC_OPTION_s, 0 }, |
| @@ -1748,7 +1746,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 32 unmodified lines | ||
| 1748 | 1746 | const TCCOption *popt; |
| 1749 | 1747 | const char *optarg, *r; |
| 1750 | 1748 | int run = 0; |
| 1751 | − int norunsrc = 0; | |
| 1752 | 1749 | int pthread = 0; |
| 1753 | 1750 | int optind = 0; |
| 1754 | 1751 | |
| @@ -1761,8 +1758,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 6 unmodified lines | ||
| 1761 | 1758 | r = argv[optind++]; |
| 1762 | 1759 | if (r[0] != '-' || r[1] == '\0') { |
| 1763 | 1760 | /* add a new file */ |
| 1764 | − if (!run || !norunsrc) | |
| 1765 | − dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r)); | |
| 1761 | + dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r)); | |
| 1766 | 1762 | if (run) { |
| 1767 | 1763 | optind--; |
| 1768 | 1764 | /* argv[0] will be this file */ |
| @@ -1888,9 +1884,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 119 unmodified lines | ||
| 1888 | 1884 | tcc_set_options(s, optarg); |
| 1889 | 1885 | run = 1; |
| 1890 | 1886 | break; |
| 1891 | − case TCC_OPTION_norunsrc: | |
| 1892 | − norunsrc = 1; | |
| 1893 | − break; | |
| 1894 | 1887 | case TCC_OPTION_v: |
| 1895 | 1888 | do ++s->verbose; while (*optarg++ == 'v'); |
| 1896 | 1889 | break; |
| @@ -69,7 +69,6 @@ static void help(void) · 68 unmodified lines | ||
| 69 | 69 | " -Bdir use 'dir' as tcc internal library and include path\n" |
| 70 | 70 | " -MD generate target dependencies for make\n" |
| 71 | 71 | " -MF depfile put generated dependencies here\n" |
| 72 | − " -norunsrc Do not compile the file which is the first argument after -run.\n" | |
| 73 | 72 | ); |
| 74 | 73 | } |
| 75 | 74 | |
| @@ -5,7 +5,7 @@ int main(int argc, char **argv) · 4 unmodified lines | ||
| 5 | 5 | int Count; |
| 6 | 6 | |
| 7 | 7 | printf("hello world %d\n", argc); |
| 8 | − for (Count = 0; Count < argc; Count++) | |
| 8 | + for (Count = 1; Count < argc; Count++) | |
| 9 | 9 | printf("arg %d: %s\n", Count, argv[Count]); |
| 10 | 10 | |
| 11 | 11 | return 0; |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | hello world 6 |
| 2 | −arg 0: 31_args.c | |
| 3 | −arg 1: - | |
| 4 | −arg 2: arg1 | |
| 5 | −arg 3: arg2 | |
| 6 | −arg 4: arg3 | |
| 7 | −arg 5: arg4 | |
| 2 | +arg 1: arg1 | |
| 3 | +arg 2: arg2 | |
| 4 | +arg 3: arg3 | |
| 5 | +arg 4: arg4 | |
| 6 | +arg 5: arg5 | |
| @@ -46,9 +46,11 @@ TESTS = \ · 45 unmodified lines | ||
| 46 | 46 | 27_sizeof.test \ |
| 47 | 47 | 28_strings.test \ |
| 48 | 48 | 29_array_address.test \ |
| 49 | + 30_hanoi.test \ | |
| 49 | 50 | 31_args.test \ |
| 50 | 51 | 32_led.test \ |
| 51 | 52 | 33_ternary_op.test \ |
| 53 | + 34_array_assignment.test \ | |
| 52 | 54 | 35_sizeof.test \ |
| 53 | 55 | 36_array_initialisers.test \ |
| 54 | 56 | 37_sprintf.test \ |
| @@ -60,6 +62,7 @@ TESTS = \ · 5 unmodified lines | ||
| 60 | 62 | 43_void_param.test \ |
| 61 | 63 | 44_scoped_declarations.test \ |
| 62 | 64 | 45_empty_for.test \ |
| 65 | + 46_grep.test \ | |
| 63 | 66 | 47_switch_return.test \ |
| 64 | 67 | 48_nested_break.test \ |
| 65 | 68 | 49_bracket_evaluation.test \ |
| @@ -81,31 +84,31 @@ TESTS = \ · 15 unmodified lines | ||
| 81 | 84 | # 34_array_assignment.test -- array assignment is not in C standard |
| 82 | 85 | # 46_grep.test -- does not compile even with gcc |
| 83 | 86 | |
| 87 | +SKIP = 30_hanoi.test 34_array_assignment.test 46_grep.test | |
| 88 | + | |
| 84 | 89 | # some tests do not pass on all platforms, remove them for now |
| 85 | 90 | ifeq ($(TARGETOS),Darwin) |
| 86 | − TESTS := $(filter-out 40_stdio.test,$(TESTS)) | |
| 91 | + SKIP += 40_stdio.test | |
| 87 | 92 | endif |
| 88 | 93 | ifdef CONFIG_WIN32 |
| 89 | − TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS)) | |
| 94 | + SKIP += 24_math_library.test # don't have round() | |
| 95 | + SKIP += 28_strings.test # don't have r/index() / strings.h | |
| 90 | 96 | endif |
| 91 | 97 | |
| 98 | +# Some tests might need arguments | |
| 99 | +ARGS = | |
| 100 | +31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5 | |
| 101 | + | |
| 102 | +all test: $(filter-out $(SKIP),$(TESTS)) | |
| 103 | + | |
| 92 | 104 | %.test: %.c %.expect |
| 93 | 105 | @echo Test: $*... |
| 94 | − @if [ "x`echo $* | grep args`" != "x" ]; \ | |
| 95 | − then $(TCC) $< -norunsrc -run $(notdir $<) - arg1 arg2 arg3 arg4 >$*.output 2>&1; \ | |
| 96 | − else $(TCC) -run $< >$*.output 2>&1; \ | |
| 97 | − ($(TCC) -o $*.exe $< && ./$*.exe) >$*.output2 2>&1; \ | |
| 98 | − fi || true | |
| 99 | − @if diff -bu $(<:.c=.expect) $*.output ; \ | |
| 100 | − then rm -f $*.output; \ | |
| 101 | − else exit 1; \ | |
| 102 | − fi | |
| 103 | − @if test -f $*.output2; then if diff -bu $(<:.c=.expect) $*.output2 ; \ | |
| 104 | − then rm -f $*.output2; \ | |
| 105 | − else exit 1; \ | |
| 106 | − fi; fi | |
| 107 | 106 | |
| 108 | −all test: $(TESTS) | |
| 107 | + @$(TCC) -run $< $(ARGS) >$*.output 2>&1 || true | |
| 108 | + @diff -bu $*.expect $*.output && rm -f $*.output | |
| 109 | + | |
| 110 | + @($(TCC) $< -o $*.exe && ./$*.exe $(ARGS)) >$*.output2 2>&1 || true | |
| 111 | + @diff -bu $*.expect $*.output2 && rm -f $*.output2 $*.exe | |
| 109 | 112 | |
| 110 | 113 | clean: |
| 111 | 114 | rm -vf fred.txt *.output* *.exe |