History

tests: Add support for codesigning command.

Allows running the tests out-of-the-box on macOS. Also delete *.dylib in tests2 dir on "make clean". One remaining issue on macOS 14.1 is that the -undefined warning option no longer works, thus breaking test3 and test1b.

Reimar Döffinger committed 3 years ago

Commit ece74ce1 parent 32ac2363 files · +16 −3Browse files

Unified · Split

3 files
  1. Makefile +6 −0
  2. tests/Makefile +5 −1
  3. tests/tests2/Makefile +5 −2
Makefile+6−0
@@ -77,6 +77,12 @@ TCCFLAGS = $(TCCFLAGS$(CFG)) · 76 unmodified lines
77TCC_LOCAL = $(TOP)/tcc$(EXESUF)77TCC_LOCAL = $(TOP)/tcc$(EXESUF)
78TCC = $(TCC_LOCAL) $(TCCFLAGS)78TCC = $(TCC_LOCAL) $(TCCFLAGS)
79 79
80ifdef CONFIG_OSX
81CODESIGN = codesign -s -
82else
83CODESIGN = true
84endif
85
80CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE86CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
81LIBS_P = $(LIBS)87LIBS_P = $(LIBS)
82LDFLAGS_P = $(LDFLAGS)88LDFLAGS_P = $(LDFLAGS)
tests/Makefile+5−1
@@ -81,7 +81,7 @@ all test : · 80 unmodified lines
81 81
82hello-exe: ../examples/ex1.c82hello-exe: ../examples/ex1.c
83 @echo ------------ $@ ------------83 @echo ------------ $@ ------------
84 $(TCC) $< -o hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC)84 $(TCC) $< -o hello$(EXESUF) && $(CODESIGN) hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC)
85 85
86hello-run: ../examples/ex1.c86hello-run: ../examples/ex1.c
87 @echo ------------ $@ ------------87 @echo ------------ $@ ------------
@@ -156,7 +156,9 @@ test4_static: tcctest.c test.ref · 68 unmodified lines
156dlltest:156dlltest:
157 @echo ------------ $@ ------------157 @echo ------------ $@ ------------
158 $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)158 $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
159 $(CODESIGN) libtcc2$(DLLSUF)
159 $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)160 $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
161 $(CODESIGN) tcc2$(EXESUF)
160 ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c162 ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
161ifeq (,$(filter Darwin WIN32,$(TARGETOS)))163ifeq (,$(filter Darwin WIN32,$(TARGETOS)))
162 @echo ------------ $@ with PIC ------------164 @echo ------------ $@ with PIC ------------
@@ -241,6 +243,7 @@ abitest-cc.exe: abitest.c $(LIBTCC) · 78 unmodified lines
241 243
242abitest-tcc.exe: abitest.c libtcc.c244abitest-tcc.exe: abitest.c libtcc.c
243 $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)245 $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)
246 $(CODESIGN) $@
244 247
245abitest-% : abitest-%.exe248abitest-% : abitest-%.exe
246 @echo ------------ $@ ------------249 @echo ------------ $@ ------------
@@ -253,6 +256,7 @@ endif · 6 unmodified lines
253 256
254vla_test$(EXESUF): vla_test.c257vla_test$(EXESUF): vla_test.c
255 $(TCC) -o $@ $^258 $(TCC) -o $@ $^
259 $(CODESIGN) $@
256 260
257vla_test-run: vla_test$(EXESUF)261vla_test-run: vla_test$(EXESUF)
258 @echo ------------ $@ ------------262 @echo ------------ $@ ------------
tests/tests2/Makefile+5−2
@@ -105,8 +105,11 @@ GEN-ALWAYS = · 104 unmodified lines
105# this test creates two DLLs and an EXE105# this test creates two DLLs and an EXE
106113_btdll.test: T1 = \106113_btdll.test: T1 = \
107 $(TCC) -bt $1 -shared -D DLL=1 -o a1$(DLLSUF) && \107 $(TCC) -bt $1 -shared -D DLL=1 -o a1$(DLLSUF) && \
108 $(CODESIGN) a1$(DLLSUF) && \
108 $(TCC) -bt $1 -shared -D DLL=2 -o a2$(DLLSUF) && \109 $(TCC) -bt $1 -shared -D DLL=2 -o a2$(DLLSUF) && \
110 $(CODESIGN) a2$(DLLSUF) && \
109 $(TCC) -bt $1 a1$(DLLSUF) a2$(DLLSUF) -Wl,-rpath=. -o $(basename $@).exe && \111 $(TCC) -bt $1 a1$(DLLSUF) a2$(DLLSUF) -Wl,-rpath=. -o $(basename $@).exe && \
112 $(CODESIGN) $(basename $@).exe && \
110 ./$(basename $@).exe113 ./$(basename $@).exe
111 114
112114_bound_signal.test: FLAGS += -b115114_bound_signal.test: FLAGS += -b
@@ -136,7 +139,7 @@ all test tests2.all: $(filter-out $(SKIP),$(TESTS)) · 23 unmodified lines
136 @$(call T1,$<) $(T3)139 @$(call T1,$<) $(T3)
137 140
138T1 = $(TCC) $(FLAGS) $(T2) $(ARGS)141T1 = $(TCC) $(FLAGS) $(T2) $(ARGS)
139T2 = $(if $(NORUN),$1 -o $(basename $@).exe && ./$(basename $@).exe,-run $1)142T2 = $(if $(NORUN),$1 -o $(basename $@).exe && $(CODESIGN) $(basename $@).exe && ./$(basename $@).exe,-run $1)
140T3 = $(FILTER) >$*.output 2>&1 || true \143T3 = $(FILTER) >$*.output 2>&1 || true \
141 && diff -Nbu $(filter %.expect,$^) $*.output \144 && diff -Nbu $(filter %.expect,$^) $*.output \
142 && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))145 && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
@@ -177,4 +180,4 @@ $(sort $(GEN-ALWAYS) $(UPDATE)) : force · 34 unmodified lines
177force:180force:
178 181
179clean :182clean :
180 rm -f fred.txt *.output *.exe *.dll *.so *.def $(GEN-ALWAYS)183 rm -f fred.txt *.output *.exe *.dll *.so *.dylib *.def $(GEN-ALWAYS)

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