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
7777 TCC_LOCAL = $(TOP)/tcc$(EXESUF)
7878 TCC = $(TCC_LOCAL) $(TCCFLAGS)
7979
80+ifdef CONFIG_OSX
81+CODESIGN = codesign -s -
82+else
83+CODESIGN = true
84+endif
85+
8086 CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
8187 LIBS_P = $(LIBS)
8288 LDFLAGS_P = $(LDFLAGS)
tests/Makefile+5−1
@@ -81,7 +81,7 @@ all test : · 80 unmodified lines
8181
8282 hello-exe: ../examples/ex1.c
8383 @echo ------------ $@ ------------
84− $(TCC) $< -o hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC)
84+ $(TCC) $< -o hello$(EXESUF) && $(CODESIGN) hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC)
8585
8686 hello-run: ../examples/ex1.c
8787 @echo ------------ $@ ------------
@@ -156,7 +156,9 @@ test4_static: tcctest.c test.ref · 68 unmodified lines
156156 dlltest:
157157 @echo ------------ $@ ------------
158158 $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF)
159+ $(CODESIGN) libtcc2$(DLLSUF)
159160 $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
161+ $(CODESIGN) tcc2$(EXESUF)
160162 ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
161163 ifeq (,$(filter Darwin WIN32,$(TARGETOS)))
162164 @echo ------------ $@ with PIC ------------
@@ -241,6 +243,7 @@ abitest-cc.exe: abitest.c $(LIBTCC) · 78 unmodified lines
241243
242244 abitest-tcc.exe: abitest.c libtcc.c
243245 $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)
246+ $(CODESIGN) $@
244247
245248 abitest-% : abitest-%.exe
246249 @echo ------------ $@ ------------
@@ -253,6 +256,7 @@ endif · 6 unmodified lines
253256
254257 vla_test$(EXESUF): vla_test.c
255258 $(TCC) -o $@ $^
259+ $(CODESIGN) $@
256260
257261 vla_test-run: vla_test$(EXESUF)
258262 @echo ------------ $@ ------------
tests/tests2/Makefile+5−2
@@ -105,8 +105,11 @@ GEN-ALWAYS = · 104 unmodified lines
105105 # this test creates two DLLs and an EXE
106106 113_btdll.test: T1 = \
107107 $(TCC) -bt $1 -shared -D DLL=1 -o a1$(DLLSUF) && \
108+ $(CODESIGN) a1$(DLLSUF) && \
108109 $(TCC) -bt $1 -shared -D DLL=2 -o a2$(DLLSUF) && \
110+ $(CODESIGN) a2$(DLLSUF) && \
109111 $(TCC) -bt $1 a1$(DLLSUF) a2$(DLLSUF) -Wl,-rpath=. -o $(basename $@).exe && \
112+ $(CODESIGN) $(basename $@).exe && \
110113 ./$(basename $@).exe
111114
112115 114_bound_signal.test: FLAGS += -b
@@ -136,7 +139,7 @@ all test tests2.all: $(filter-out $(SKIP),$(TESTS)) · 23 unmodified lines
136139 @$(call T1,$<) $(T3)
137140
138141 T1 = $(TCC) $(FLAGS) $(T2) $(ARGS)
139−T2 = $(if $(NORUN),$1 -o $(basename $@).exe && ./$(basename $@).exe,-run $1)
142+T2 = $(if $(NORUN),$1 -o $(basename $@).exe && $(CODESIGN) $(basename $@).exe && ./$(basename $@).exe,-run $1)
140143 T3 = $(FILTER) >$*.output 2>&1 || true \
141144 && diff -Nbu $(filter %.expect,$^) $*.output \
142145 && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
@@ -177,4 +180,4 @@ $(sort $(GEN-ALWAYS) $(UPDATE)) : force · 34 unmodified lines
177180 force:
178181
179182 clean :
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