E. Scott Daniels | 4e4fb50 | 2020-03-24 12:28:06 -0400 | [diff] [blame] | 1 | |
| 2 | coverage_opts = -ftest-coverage -fprofile-arcs |
| 3 | |
E. Scott Daniels | d486a17 | 2020-07-29 12:39:54 -0400 | [diff] [blame^] | 4 | binaries = unit_test jhash_test config_test metrics_test |
| 5 | include = -I ../src/xapp -I ../src/alarm -I ../src/messaging -I ../src/config -I ../ext/jsmn -I ../src/json -I ../src/metrics |
| 6 | ld_path = LD_LIBRARY_PATH=../src/.build |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 7 | |
E. Scott Daniels | d486a17 | 2020-07-29 12:39:54 -0400 | [diff] [blame^] | 8 | tests:: $(binaries) |
E. Scott Daniels | 4e4fb50 | 2020-03-24 12:28:06 -0400 | [diff] [blame] | 9 | |
| 10 | # RMR emulation |
| 11 | rmr_em.o:: rmr_em.c |
| 12 | cc -g rmr_em.c -c |
| 13 | |
E. Scott Daniels | ef36205 | 2020-07-22 15:49:54 -0400 | [diff] [blame] | 14 | # include the emulated rmr stuff, but we still need the rmr lib for symtab things which we cannot hope to |
| 15 | # emulate (and don't need to) |
| 16 | # |
E. Scott Daniels | 4e4fb50 | 2020-03-24 12:28:06 -0400 | [diff] [blame] | 17 | unit_test:: unit_test.cpp rmr_em.o |
E. Scott Daniels | d486a17 | 2020-07-29 12:39:54 -0400 | [diff] [blame^] | 18 | g++ -g $(coverage_opts) $(include) unit_test.cpp -o unit_test -L../.build -lricxfcpp rmr_em.o -lrmr_si -lpthread |
E. Scott Daniels | 4e4fb50 | 2020-03-24 12:28:06 -0400 | [diff] [blame] | 19 | |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 20 | # build a special jwrapper object with coverage settings |
| 21 | jwrapper_test.o:: ../src/json/jwrapper.c ../src/json/jwrapper.h |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame] | 22 | cc $(coverage_opts) -g -I ../src/json -I ../ext/jsmn ../src/json/jwrapper.c -c -o jwrapper_test.o |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 23 | |
| 24 | jhash_test:: jwrapper_test.o jhash_test.cpp |
| 25 | # do NOT link the xapp lib; we include all modules in the test programme |
| 26 | g++ -g $(coverage_opts) -I ../src/json -I ../ext/jsmn jhash_test.cpp -o jhash_test jwrapper_test.o -lrmr_si -lpthread |
| 27 | |
E. Scott Daniels | ef36205 | 2020-07-22 15:49:54 -0400 | [diff] [blame] | 28 | metrics_test:: metrics_test.cpp rmr_em.o |
E. Scott Daniels | d486a17 | 2020-07-29 12:39:54 -0400 | [diff] [blame^] | 29 | g++ -g $(coverage_opts) $(include) metrics_test.cpp -o metrics_test -L../.build -lricxfcpp rmr_em.o -l rmr_si -lpthread |
| 30 | |
| 31 | config_test:: config_test.cpp jwrapper_test.o |
| 32 | g++ -g $(coverage_opts) $(include) config_test.cpp -o config_test jwrapper_test.o -lricxfcpp -lrmr_si -lpthread |
E. Scott Daniels | ef36205 | 2020-07-22 15:49:54 -0400 | [diff] [blame] | 33 | |
E. Scott Daniels | 4e4fb50 | 2020-03-24 12:28:06 -0400 | [diff] [blame] | 34 | # prune gcov files generated by system include files |
| 35 | clean:: |
| 36 | rm -f *.h.gcov *.c.gcov |
| 37 | |
| 38 | # ditch anything that can be rebuilt |
| 39 | nuke:: |
| 40 | rm -f *.a *.o *.gcov *.gcda *.gcno core a.out $(binaries) |
| 41 | |