History

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 e31579b0769e1f9c0947d12e83316d1149307b1a

grischka committed 12 years ago

Commit f90bad01 parent 76accfb5 files · +26 −32Browse files

Unified · Split

5 files
  1. libtcc.c +1 −8
  2. tcc.c +0 −1
  3. tests/tests2/31_args.c +1 −1
  4. tests/tests2/31_args.expect +5 −6
  5. tests/tests2/Makefile +19 −16
libtcc.c+1−8
@@ -1666,7 +1666,6 @@ enum { · 1665 unmodified lines
16661666 TCC_OPTION_pedantic,
16671667 TCC_OPTION_pthread,
16681668 TCC_OPTION_run,
1669− TCC_OPTION_norunsrc,
16701669 TCC_OPTION_v,
16711670 TCC_OPTION_w,
16721671 TCC_OPTION_pipe,
@@ -1709,7 +1708,6 @@ static const TCCOption tcc_options[] = { · 36 unmodified lines
17091708 { "pedantic", TCC_OPTION_pedantic, 0},
17101709 { "pthread", TCC_OPTION_pthread, 0},
17111710 { "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
1712− { "norunsrc", TCC_OPTION_norunsrc, 0 },
17131711 { "rdynamic", TCC_OPTION_rdynamic, 0 },
17141712 { "r", TCC_OPTION_r, 0 },
17151713 { "s", TCC_OPTION_s, 0 },
@@ -1748,7 +1746,6 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 32 unmodified lines
17481746 const TCCOption *popt;
17491747 const char *optarg, *r;
17501748 int run = 0;
1751− int norunsrc = 0;
17521749 int pthread = 0;
17531750 int optind = 0;
17541751
@@ -1761,8 +1758,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 6 unmodified lines
17611758 r = argv[optind++];
17621759 if (r[0] != '-' || r[1] == '\0') {
17631760 /* 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));
17661762 if (run) {
17671763 optind--;
17681764 /* 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
18881884 tcc_set_options(s, optarg);
18891885 run = 1;
18901886 break;
1891− case TCC_OPTION_norunsrc:
1892− norunsrc = 1;
1893− break;
18941887 case TCC_OPTION_v:
18951888 do ++s->verbose; while (*optarg++ == 'v');
18961889 break;
tcc.c+0−1
@@ -69,7 +69,6 @@ static void help(void) · 68 unmodified lines
6969 " -Bdir use 'dir' as tcc internal library and include path\n"
7070 " -MD generate target dependencies for make\n"
7171 " -MF depfile put generated dependencies here\n"
72− " -norunsrc Do not compile the file which is the first argument after -run.\n"
7372 );
7473 }
7574
tests/tests2/31_args.c+1−1
@@ -5,7 +5,7 @@ int main(int argc, char **argv) · 4 unmodified lines
55 int Count;
66
77 printf("hello world %d\n", argc);
8− for (Count = 0; Count < argc; Count++)
8+ for (Count = 1; Count < argc; Count++)
99 printf("arg %d: %s\n", Count, argv[Count]);
1010
1111 return 0;
tests/tests2/31_args.expect+5−6
@@ -1,7 +1,6 @@
11 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
tests/tests2/Makefile+19−16
@@ -46,9 +46,11 @@ TESTS = \ · 45 unmodified lines
4646 27_sizeof.test \
4747 28_strings.test \
4848 29_array_address.test \
49+ 30_hanoi.test \
4950 31_args.test \
5051 32_led.test \
5152 33_ternary_op.test \
53+ 34_array_assignment.test \
5254 35_sizeof.test \
5355 36_array_initialisers.test \
5456 37_sprintf.test \
@@ -60,6 +62,7 @@ TESTS = \ · 5 unmodified lines
6062 43_void_param.test \
6163 44_scoped_declarations.test \
6264 45_empty_for.test \
65+ 46_grep.test \
6366 47_switch_return.test \
6467 48_nested_break.test \
6568 49_bracket_evaluation.test \
@@ -81,31 +84,31 @@ TESTS = \ · 15 unmodified lines
8184 # 34_array_assignment.test -- array assignment is not in C standard
8285 # 46_grep.test -- does not compile even with gcc
8386
87+SKIP = 30_hanoi.test 34_array_assignment.test 46_grep.test
88+
8489 # some tests do not pass on all platforms, remove them for now
8590 ifeq ($(TARGETOS),Darwin)
86− TESTS := $(filter-out 40_stdio.test,$(TESTS))
91+ SKIP += 40_stdio.test
8792 endif
8893 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
9096 endif
9197
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+
92104 %.test: %.c %.expect
93105 @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
107106
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
109112
110113 clean:
111114 rm -vf fred.txt *.output* *.exe

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t