Added tests for iterators and NC info. Added test programs for
[krb5.git] / src / ccapi / test / Makefile.in
1 thisconfigdir=..$(S)..
2 myfulldir=ccapi$(S)test
3 mydir=ccapi$(S)test
4 BUILDTOP=..$(S)..
5
6 !if defined(KRB5_KFW_COMPILE)
7 KFWINC= /I$(BUILDTOP)\..\..\krbcc\include
8 !endif
9
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.
14
15 # run with "make all" to create CCAPI tests in "/tmp/ccapi_test"
16 # run resulting tests with "sh test_ccapi.sh"
17
18 ##DOS##CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \
19 ##DOS##    -D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS
20
21 ##DOS##WINH = cci_debugging.h \
22 ##DOS##       ccs_reply.h \
23 ##DOS##       ccs_request.h \
24 ##DOS##       ccs_request_c.c \
25 ##DOS##       cci_stream.h \
26 ##DOS##       cci_types.h \
27 ##DOS##       win-utils.h
28
29 SRCDIR  = .
30 DSTROOT = $(SRCDIR)
31 OBJDIR  = $(DSTROOT)$(S)ccapi_intermediates
32 DSTDIR  = $(DSTROOT)$(S)ccapi_test
33 TESTDIR = $(DSTDIR)$(S)tests
34
35 SCRIPT_NAME = test_ccapi.sh
36
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)
46
47 PINGOBJS =  $(OUTPRE)ccs_request_c.$(OBJEXT) \
48             $(OUTPRE)pingtest.$(OBJEXT) \
49             $(OBJECTS)
50
51 TESTALLOBJS=$(OUTPRE)main.$(OBJEXT) \
52             $(OBJECTS)
53
54 TEST_NAMES =    test_cc_ccache_iterator_next \
55                 test_constants \
56                 test_cc_initialize \
57                 test_cc_credentials_iterator_next
58                 
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 \
81                 test_cc_ccache_move \
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 \
86                 test_cc_shutdown \
87                 test_cc_get_change_time \
88                 test_cc_open \
89                 test_cc_create \
90                 test_cc_close \
91                 test_cc_destroy \
92                 test_cc_get_cred_version \
93                 test_cc_get_name \
94                 test_cc_get_principal \
95                 test_cc_set_principal \
96                 test_cc_store \
97                 test_cc_remove_cred \
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 \
102                 test_cc_get_NC_info
103
104
105 ##### Linker
106 LINK    = link
107 LIBS    = -lkrb5
108 ##DOS##LIBS = advapi32.lib rpcrt4.lib user32.lib ws2_32.lib ccapi.lib
109 LFLAGS  = /nologo $(LOPTS)
110
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
113
114 # compile base files used by all tests
115 build-base: $(PINGOBJS)
116
117 ##++ These two rules build each element of the list:
118 # compile each test
119 build-tests: $(TEST_NAMES)
120     @echo build-tests complete.
121     
122 $(TEST_NAMES): 
123     @echo DBG: $@    
124     $(CC) $(ALL_CFLAGS) -Fe$(TESTDIR)$(S)$@.exe -Fd$(OBJDIR)$(S)$@.obj $@.c $(OBJECTS) $(LIBS)
125 # Clean .obj from .:
126     $(RM) $@.$(OBJEXT)
127 ##-- These two rules build each element of the list.
128     
129 # Make a build directory
130 setup-test-dir:
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
135         mkdir -p "$(OBJDIR)"
136         
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)
141         set LINK = link
142     
143 # This rule assumes that nmake in ..\lib\win has already run.
144 #   That is how ..\Makefile.in is set up.
145 $(WINH):
146     copy ..\lib\win\srctmp\$@ .
147
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
155     perl setlib.pl
156     if not exist a.tmp (
157         @echo Adding ..\lib\win\srctmp to LIB
158         set LIB=%%LIB%%;..\lib\win\srctmp
159         )
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) 
162
163 link-tests: $(TEST_NAMES)
164
165 build-testall: $(TEST_NAMES) $(OBJECTS) $(TESTALLOBJS) testall.exe
166
167 testall.exe:
168     $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(TESTALLOBJS) $(LIBS) $(conslibdll)
169
170
171 simple_lock_test:
172         $(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c $(LIBS)
173
174 copy-script:
175         cp $(SCRIPT_NAME) $(DSTDIR)/$(SCRIPT_NAME)
176
177 success-message:
178         @echo
179         @echo "CCAPI tests created in $(DSTDIR)"
180
181 .PHONY: clean
182
183 clean::
184         -rm -rf "$(OBJDIR)"