blob: ed3620521338b3c58b6458480c6f018bd0f04526 [file] [log] [blame]
E. Scott Daniels4e4fb502020-03-24 12:28:06 -04001
2coverage_opts = -ftest-coverage -fprofile-arcs
3
E. Scott Danielsd486a172020-07-29 12:39:54 -04004binaries = unit_test jhash_test config_test metrics_test
sandeepindiae64778d2022-12-06 00:17:19 +05305include = -I ../src/xapp -I ../src/alarm -I ../src/messaging -I ../src/config -I ../ext/jsmn -I ../src/json -I ../src/metrics -I ../src/model -I ../src/rest-client -I ../src/rest-server
E. Scott Daniels97204c82020-06-29 15:39:57 -04006
E. Scott Danielsd486a172020-07-29 12:39:54 -04007tests:: $(binaries)
E. Scott Daniels4e4fb502020-03-24 12:28:06 -04008
9# RMR emulation
10rmr_em.o:: rmr_em.c
11 cc -g rmr_em.c -c
12
E. Scott Danielsef362052020-07-22 15:49:54 -040013# include the emulated rmr stuff, but we still need the rmr lib for symtab things which we cannot hope to
14# emulate (and don't need to)
15#
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040016unit_test:: unit_test.cpp rmr_em.o
sandeepindiae64778d2022-12-06 00:17:19 +053017 g++ -g $(coverage_opts) $(include) unit_test.cpp -o unit_test -L../.build -lricxfcpp rmr_em.o -lrmr_si -lpthread -lm -lboost_system -lcrypto -lssl -lcpprest -lpistache -lnlohmann_json_schema_validator
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040018
E. Scott Daniels97204c82020-06-29 15:39:57 -040019# build a special jwrapper object with coverage settings
20jwrapper_test.o:: ../src/json/jwrapper.c ../src/json/jwrapper.h
E. Scott Daniels368cf5e2020-07-31 10:51:24 -040021 cc $(coverage_opts) -DDEBUG=0 -g -I ../src/json -I ../ext/jsmn ../src/json/jwrapper.c -c -o jwrapper_test.o
E. Scott Daniels97204c82020-06-29 15:39:57 -040022
23jhash_test:: jwrapper_test.o jhash_test.cpp
24 # do NOT link the xapp lib; we include all modules in the test programme
sandeepindiae64778d2022-12-06 00:17:19 +053025 g++ -g $(coverage_opts) -I ../src/json -I ../ext/jsmn jhash_test.cpp -o jhash_test jwrapper_test.o -lrmr_si -lpthread -lm -lboost_system -lcrypto -lssl -lcpprest -lpistache -lnlohmann_json_schema_validator
E. Scott Daniels97204c82020-06-29 15:39:57 -040026
E. Scott Danielsef362052020-07-22 15:49:54 -040027metrics_test:: metrics_test.cpp rmr_em.o
sandeepindiae64778d2022-12-06 00:17:19 +053028 g++ -g $(coverage_opts) $(include) metrics_test.cpp -o metrics_test -L../.build -lricxfcpp rmr_em.o -l rmr_si -lpthread -lm -lboost_system -lcrypto -lssl -lcpprest -lpistache -lnlohmann_json_schema_validator
E. Scott Danielsd486a172020-07-29 12:39:54 -040029
30config_test:: config_test.cpp jwrapper_test.o
sandeepindiae64778d2022-12-06 00:17:19 +053031 g++ -g $(coverage_opts) $(include) config_test.cpp -o config_test jwrapper_test.o -lricxfcpp -lrmr_si -lpthread -lm -lboost_system -lcrypto -lssl -lcpprest -lpistache -lnlohmann_json_schema_validator
E. Scott Danielsef362052020-07-22 15:49:54 -040032
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040033# prune gcov files generated by system include files
34clean::
35 rm -f *.h.gcov *.c.gcov
36
37# ditch anything that can be rebuilt
38nuke::
39 rm -f *.a *.o *.gcov *.gcda *.gcno core a.out $(binaries)
40
sandeepindiae64778d2022-12-06 00:17:19 +053041