2 myfulldir=ccapi$(S)test
6 !if defined(KRB5_KFW_COMPILE)
7 KFWINC= /I$(BUILDTOP)\..\..\krbcc\include
10 # Because all the sources are in .,
11 # the only includes we need are to directories outside of ccapi.
12 LOCALINCLUDES = /I$(BUILDTOP) /I$(BUILDTOP)$(S)include /I$(BUILDTOP)$(S)include$(S)krb5 $(KFWINC) \
13 -I$(BUILDTOP)$(S)util$(S)et /I.
15 # run with "make all" to create CCAPI tests in "/tmp/ccapi_test"
16 # run resulting tests with "sh test_ccapi.sh"
18 ##DOS##CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \
19 ##DOS## -D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS
21 ##DOS##WINH = cci_debugging.h \
23 ##DOS## ccs_request.h \
24 ##DOS## ccs_request_c.c \
25 ##DOS## cci_stream.h \
31 OBJDIR = $(DSTROOT)$(S)ccapi_intermediates
32 DSTDIR = $(DSTROOT)$(S)ccapi_test
33 TESTDIR = $(DSTDIR)$(S)tests
35 SCRIPT_NAME = test_ccapi.sh
37 OBJECTS = $(OUTPRE)test_ccapi_ccache.$(OBJEXT) \
38 $(OUTPRE)test_ccapi_check.$(OBJEXT) \
39 $(OUTPRE)test_ccapi_constants.$(OBJEXT) \
40 $(OUTPRE)test_ccapi_context.$(OBJEXT) \
41 $(OUTPRE)test_ccapi_v2.$(OBJEXT) \
42 $(OUTPRE)test_ccapi_globals.$(OBJEXT) \
43 $(OUTPRE)test_ccapi_iterators.$(OBJEXT) \
44 $(OUTPRE)test_ccapi_log.$(OBJEXT) \
45 $(OUTPRE)test_ccapi_util.$(OBJEXT)
47 PINGOBJS = $(OUTPRE)ccs_request_c.$(OBJEXT) \
48 $(OUTPRE)pingtest.$(OBJEXT) \
51 TESTALLOBJS=$(OUTPRE)main.$(OBJEXT) \
54 TEST_NAMES = test_cc_ccache_iterator_next \
57 test_cc_credentials_iterator_next
59 MORE_TESTS = test_cc_context_release \
60 test_cc_context_get_change_time \
61 test_cc_context_get_default_ccache_name \
62 test_cc_context_open_ccache \
63 test_cc_context_open_default_ccache \
64 test_cc_context_create_ccache \
65 test_cc_context_create_default_ccache \
66 test_cc_context_create_new_ccache \
67 test_cc_context_new_ccache_iterator \
68 test_cc_context_compare \
69 test_cc_ccache_release \
70 test_cc_ccache_destroy \
71 test_cc_ccache_set_default \
72 test_cc_ccache_get_credentials_version \
73 test_cc_ccache_get_name \
74 test_cc_ccache_get_principal \
75 test_cc_ccache_set_principal \
76 test_cc_ccache_store_credentials \
77 test_cc_ccache_remove_credentials \
78 test_cc_ccache_new_credentials_iterator \
79 test_cc_ccache_get_change_time \
80 test_cc_ccache_get_last_default_time \
82 test_cc_ccache_compare \
83 test_cc_ccache_get_kdc_time_offset \
84 test_cc_ccache_set_kdc_time_offset \
85 test_cc_ccache_clear_kdc_time_offset \
87 test_cc_get_change_time \
92 test_cc_get_cred_version \
94 test_cc_get_principal \
95 test_cc_set_principal \
98 test_cc_seq_fetch_NCs_begin \
99 test_cc_seq_fetch_NCs_next \
100 test_cc_seq_fetch_creds_begin \
101 test_cc_seq_fetch_creds_next \
108 ##DOS##LIBS = advapi32.lib rpcrt4.lib user32.lib ws2_32.lib ccapi.lib
109 LFLAGS = /nologo $(LOPTS)
111 all-mac:: setup-test-dir pingtest simple_lock_test build-base build-tests link-tests copy-script success-message
112 all-windows:: setup-windows build-base $(OUTPRE)pingtest.exe build-tests build-testall copy-script success-message
114 # compile base files used by all tests
115 build-base: $(PINGOBJS)
117 ##++ These two rules build each element of the list:
119 build-tests: $(TEST_NAMES)
120 @echo build-tests complete.
124 $(CC) $(ALL_CFLAGS) -Fe$(TESTDIR)$(S)$@.exe -Fd$(OBJDIR)$(S)$@.obj $@.c $(OBJECTS) $(LIBS)
127 ##-- These two rules build each element of the list.
129 # Make a build directory
131 @echo "Removing old destination directory... $(DSTDIR)"
132 if [ -d "$(DSTDIR)" ]; then chmod -R u+w "$(DSTDIR)" && rm -rf "$(DSTDIR)"; fi
133 mkdir -p "$(TESTDIR)"
134 if [ -d "$(OBJDIR)" ]; then chmod -R u+w "$(OBJDIR)" && rm -rf "$(OBJDIR)"; fi
137 ## The same trick as used in TEST_NAMES to run an action on each element ofthe list WINH:
138 setup-windows: $(WINH)
139 if NOT exist $(TESTDIR) mkdir $(TESTDIR)
140 if NOT exist $(OBJDIR) mkdir $(OBJDIR)
143 # This rule assumes that nmake in ..\lib\win has already run.
144 # That is how ..\Makefile.in is set up.
146 copy ..\lib\win\srctmp\$@ .
148 # This rule assumes that nmake in ..\lib\win\ has already run.
149 $(OUTPRE)pingtest.exe: $(OBJECTS) $(PINGOBJS)
150 # There doesn't appear to be any way to examine a variable and return a value
151 # indicating whether a string is present in it. We use a perl script to
152 # check the LIB variable. If the path to ccapi.lib isn't present, the script
153 # deletes a.tmp and the following nmake actions correct LIB.
154 echo %%PATH%% > a.tmp
157 @echo Adding ..\lib\win\srctmp to LIB
158 set LIB=%%LIB%%;..\lib\win\srctmp
160 $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(PINGOBJS) $(LIBS)
161 $(LINK) $(LFLAGS) /map:$(@B)2.map /out:$(*B)2.exe $(conflags) $(PINGOBJS) $(LIBS) $(conlibsdll)
163 link-tests: $(TEST_NAMES)
165 build-testall: $(TEST_NAMES) $(OBJECTS) $(TESTALLOBJS) testall.exe
168 $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(TESTALLOBJS) $(LIBS) $(conslibdll)
172 $(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c $(LIBS)
175 cp $(SCRIPT_NAME) $(DSTDIR)/$(SCRIPT_NAME)
179 @echo "CCAPI tests created in $(DSTDIR)"