From: Juergen Perlinger Date: Sat, 30 Dec 2017 09:01:53 +0000 (+0100) Subject: unit tests: avoid CD to source dir when calling ruby X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=814f01b4942445bd2dfd78bda6488e07e61a7167;p=thirdparty%2Fntp.git unit tests: avoid CD to source dir when calling ruby bk: 5a4756014s7lRqlGsX4bKNjMBR3wVw --- diff --git a/sntp/tests/Makefile.am b/sntp/tests/Makefile.am index 4de15cdeb..d51a736a1 100644 --- a/sntp/tests/Makefile.am +++ b/sntp/tests/Makefile.am @@ -26,7 +26,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) # Use EXTRA_PROGRAMS for test files that are under development but # not production-ready @@ -188,31 +188,31 @@ test_log_SOURCES = \ $(srcdir)/run-kodFile.c: $(srcdir)/kodFile.c $(std_unity_list) - $(run_unity) kodFile.c run-kodFile.c + $(run_unity) $< $@ $(srcdir)/run-keyFile.c: $(srcdir)/keyFile.c $(std_unity_list) - $(run_unity) keyFile.c run-keyFile.c + $(run_unity) $< $@ $(srcdir)/run-kodDatabase.c: $(srcdir)/kodDatabase.c $(std_unity_list) - $(run_unity) kodDatabase.c run-kodDatabase.c + $(run_unity) $< $@ $(srcdir)/run-networking.c: $(srcdir)/networking.c $(std_unity_list) - $(run_unity) networking.c run-networking.c + $(run_unity) $< $@ $(srcdir)/run-packetProcessing.c: $(srcdir)/packetProcessing.c $(std_unity_list) - $(run_unity) packetProcessing.c run-packetProcessing.c + $(run_unity) $< $@ $(srcdir)/run-packetHandling.c: $(srcdir)/packetHandling.c $(std_unity_list) - $(run_unity) packetHandling.c run-packetHandling.c + $(run_unity) $< $@ $(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list) - $(run_unity) utilities.c run-utilities.c + $(run_unity) $< $@ $(srcdir)/run-crypto.c: $(srcdir)/crypto.c $(std_unity_list) - $(run_unity) crypto.c run-crypto.c + $(run_unity) $< $@ $(srcdir)/run-t-log.c: $(srcdir)/t-log.c $(std_unity_list) - $(run_unity) t-log.c run-t-log.c + $(run_unity) $< $@ #$(srcdir)/../version.c: $(srcdir)/../version.c diff --git a/sntp/unity/auto/generate_test_runner.rb b/sntp/unity/auto/generate_test_runner.rb index b4f424df7..22d10dbc1 100644 --- a/sntp/unity/auto/generate_test_runner.rb +++ b/sntp/unity/auto/generate_test_runner.rb @@ -323,13 +323,13 @@ class UnityTestRunnerGenerator output.puts(" progname = argv[0];\n") - + modname = filename.split(/[\/\\]/).last output.puts(" suite_setup();") unless @options[:suite_setup].nil? - output.puts(" UnityBegin(\"#{filename}\");") + output.puts(" UnityBegin(\"#{modname}\");") if (@options[:use_param_tests]) tests.each do |test| diff --git a/tests/bug-2803/Makefile.am b/tests/bug-2803/Makefile.am index d0f53a092..8b8b96e00 100644 --- a/tests/bug-2803/Makefile.am +++ b/tests/bug-2803/Makefile.am @@ -8,7 +8,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = bug-2803 @@ -42,7 +42,7 @@ bug_2803_SOURCES = \ $(NULL) $(srcdir)/run-bug-2803.c: $(srcdir)/bug-2803.c $(std_unity_list) - $(run_unity) bug-2803.c run-bug-2803.c + $(run_unity) $< $@ # HMS: we may not need some of these: #noinst_HEADERS = ntpdtest.h \ diff --git a/tests/libntp/Makefile.am b/tests/libntp/Makefile.am index 1864e296f..c78087c09 100644 --- a/tests/libntp/Makefile.am +++ b/tests/libntp/Makefile.am @@ -7,7 +7,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = \ test-a_md5encrypt \ @@ -129,7 +129,7 @@ test_a_md5encrypt_SOURCES = \ $(NULL) $(srcdir)/run-a_md5encrypt.c: $(srcdir)/a_md5encrypt.c $(std_unity_list) - $(run_unity) a_md5encrypt.c run-a_md5encrypt.c + $(run_unity) $< $@ ### @@ -139,7 +139,7 @@ test_atoint_SOURCES = \ $(NULL) $(srcdir)/run-atoint.c: $(srcdir)/atoint.c $(std_unity_list) - $(run_unity) atoint.c run-atoint.c + $(run_unity) $< $@ ### @@ -149,7 +149,7 @@ test_atouint_SOURCES = \ $(NULL) $(srcdir)/run-atouint.c: $(srcdir)/atouint.c $(std_unity_list) - $(run_unity) atouint.c run-atouint.c + $(run_unity) $< $@ ### @@ -159,7 +159,7 @@ test_authkeys_SOURCES = \ $(NULL) $(srcdir)/run-authkeys.c: $(srcdir)/authkeys.c $(std_unity_list) - $(run_unity) authkeys.c run-authkeys.c + $(run_unity) $< $@ ### @@ -170,7 +170,7 @@ test_buftvtots_SOURCES = \ $(NULL) $(srcdir)/run-buftvtots.c: $(srcdir)/buftvtots.c $(std_unity_list) - $(run_unity) buftvtots.c run-buftvtots.c + $(run_unity) $< $@ ### @@ -181,7 +181,7 @@ test_calendar_SOURCES = \ $(NULL) $(srcdir)/run-calendar.c: $(srcdir)/calendar.c $(std_unity_list) - $(run_unity) calendar.c run-calendar.c + $(run_unity) $< $@ ### @@ -196,7 +196,7 @@ test_caltontp_SOURCES = \ $(NULL) $(srcdir)/run-caltontp.c: $(srcdir)/caltontp.c $(std_unity_list) - $(run_unity) caltontp.c run-caltontp.c + $(run_unity) $< $@ ### @@ -212,7 +212,7 @@ test_caljulian_SOURCES = \ $(NULL) $(srcdir)/run-caljulian.c: $(srcdir)/caljulian.c $(std_unity_list) - $(run_unity) caljulian.c run-caljulian.c + $(run_unity) $< $@ ### @@ -223,7 +223,7 @@ test_calyearstart_SOURCES = \ $(NULL) $(srcdir)/run-calyearstart.c: $(srcdir)/calyearstart.c $(std_unity_list) - $(run_unity) calyearstart.c run-calyearstart.c + $(run_unity) $< $@ ### @@ -234,7 +234,7 @@ test_clocktime_SOURCES = \ $(NULL) $(srcdir)/run-clocktime.c: $(srcdir)/clocktime.c $(std_unity_list) - $(run_unity) clocktime.c run-clocktime.c + $(run_unity) $< $@ ### @@ -250,7 +250,7 @@ test_decodenetnum_SOURCES = \ $(NULL) $(srcdir)/run-decodenetnum.c: $(srcdir)/decodenetnum.c $(std_unity_list) - $(run_unity) decodenetnum.c run-decodenetnum.c + $(run_unity) $< $@ ### @@ -260,7 +260,7 @@ test_hextoint_SOURCES = \ $(NULL) $(srcdir)/run-hextoint.c: $(srcdir)/hextoint.c $(std_unity_list) - $(run_unity) hextoint.c run-hextoint.c + $(run_unity) $< $@ ### @@ -271,7 +271,7 @@ test_hextolfp_SOURCES = \ $(NULL) $(srcdir)/run-hextolfp.c: $(srcdir)/hextolfp.c $(std_unity_list) - $(run_unity) hextolfp.c run-hextolfp.c + $(run_unity) $< $@ ### @@ -281,7 +281,7 @@ test_humandate_SOURCES = \ $(NULL) $(srcdir)/run-humandate.c: $(srcdir)/humandate.c $(std_unity_list) - $(run_unity) humandate.c run-humandate.c + $(run_unity) $< $@ ### @@ -291,7 +291,7 @@ test_lfpfunc_SOURCES = \ $(NULL) $(srcdir)/run-lfpfunc.c: $(srcdir)/lfpfunc.c $(std_unity_list) - $(run_unity) lfpfunc.c run-lfpfunc.c + $(run_unity) $< $@ ### @@ -301,7 +301,7 @@ test_lfptostr_SOURCES = \ $(NULL) $(srcdir)/run-lfptostr.c: $(srcdir)/lfptostr.c $(std_unity_list) - $(run_unity) lfptostr.c run-lfptostr.c + $(run_unity) $< $@ ### @@ -311,7 +311,7 @@ test_modetoa_SOURCES = \ $(NULL) $(srcdir)/run-modetoa.c: $(srcdir)/modetoa.c $(std_unity_list) - $(run_unity) modetoa.c run-modetoa.c + $(run_unity) $< $@ ### @@ -321,7 +321,7 @@ test_msyslog_SOURCES = \ $(NULL) $(srcdir)/run-msyslog.c: $(srcdir)/msyslog.c $(std_unity_list) - $(run_unity) msyslog.c run-msyslog.c + $(run_unity) $< $@ ### @@ -332,7 +332,7 @@ test_netof_SOURCES = \ $(NULL) $(srcdir)/run-netof.c: $(srcdir)/netof.c $(std_unity_list) - $(run_unity) netof.c run-netof.c + $(run_unity) $< $@ ### @@ -342,7 +342,7 @@ test_numtoa_SOURCES = \ $(NULL) $(srcdir)/run-numtoa.c: $(srcdir)/numtoa.c $(std_unity_list) - $(run_unity) numtoa.c run-numtoa.c + $(run_unity) $< $@ ### @@ -352,7 +352,7 @@ test_numtohost_SOURCES = \ $(NULL) $(srcdir)/run-numtohost.c: $(srcdir)/numtohost.c $(std_unity_list) - $(run_unity) numtohost.c run-numtohost.c + $(run_unity) $< $@ ### @@ -362,7 +362,7 @@ test_octtoint_SOURCES = \ $(NULL) $(srcdir)/run-octtoint.c: $(srcdir)/octtoint.c $(std_unity_list) - $(run_unity) octtoint.c run-octtoint.c + $(run_unity) $< $@ ### @@ -372,7 +372,7 @@ test_prettydate_SOURCES = \ $(NULL) $(srcdir)/run-prettydate.c: $(srcdir)/prettydate.c $(std_unity_list) - $(run_unity) prettydate.c run-prettydate.c + $(run_unity) $< $@ ### @@ -382,7 +382,7 @@ test_recvbuff_SOURCES = \ $(NULL) $(srcdir)/run-recvbuff.c: $(srcdir)/recvbuff.c $(std_unity_list) - $(run_unity) recvbuff.c run-recvbuff.c + $(run_unity) $< $@ ### @@ -392,7 +392,7 @@ test_refidsmear_SOURCES = \ $(NULL) $(srcdir)/run-refidsmear.c: $(srcdir)/refidsmear.c $(std_unity_list) - $(run_unity) refidsmear.c run-refidsmear.c + $(run_unity) $< $@ ### @@ -402,7 +402,7 @@ test_refnumtoa_SOURCES = \ $(NULL) $(srcdir)/run-refnumtoa.c: $(srcdir)/refnumtoa.c $(std_unity_list) - $(run_unity) refnumtoa.c run-refnumtoa.c + $(run_unity) $< $@ ### @@ -412,7 +412,7 @@ test_sfptostr_SOURCES = \ $(NULL) $(srcdir)/run-sfptostr.c: $(srcdir)/sfptostr.c $(std_unity_list) - $(run_unity) sfptostr.c run-sfptostr.c + $(run_unity) $< $@ ### @@ -423,7 +423,7 @@ test_socktoa_SOURCES = \ $(NULL) $(srcdir)/run-socktoa.c: $(srcdir)/socktoa.c $(std_unity_list) - $(run_unity) socktoa.c run-socktoa.c + $(run_unity) $< $@ ### @@ -433,7 +433,7 @@ test_ssl_init_SOURCES = \ $(NULL) $(srcdir)/run-ssl_init.c: $(srcdir)/ssl_init.c $(std_unity_list) - $(run_unity) ssl_init.c run-ssl_init.c + $(run_unity) $< $@ ### @@ -443,7 +443,7 @@ test_statestr_SOURCES = \ $(NULL) $(srcdir)/run-statestr.c: $(srcdir)/statestr.c $(std_unity_list) - $(run_unity) statestr.c run-statestr.c + $(run_unity) $< $@ ### @@ -459,7 +459,7 @@ test_strtolfp_SOURCES = \ $(NULL) $(srcdir)/run-strtolfp.c: $(srcdir)/strtolfp.c $(std_unity_list) - $(run_unity) strtolfp.c run-strtolfp.c + $(run_unity) $< $@ ### @@ -469,7 +469,7 @@ test_timespecops_SOURCES = \ $(NULL) $(srcdir)/run-timespecops.c: $(srcdir)/timespecops.c $(std_unity_list) - $(run_unity) timespecops.c run-timespecops.c + $(run_unity) $< $@ ### @@ -479,7 +479,7 @@ test_timevalops_SOURCES = \ $(NULL) $(srcdir)/run-timevalops.c: $(srcdir)/timevalops.c $(std_unity_list) - $(run_unity) timevalops.c run-timevalops.c + $(run_unity) $< $@ ### @@ -489,7 +489,7 @@ test_tsafememcmp_SOURCES = \ $(NULL) $(srcdir)/run-tsafememcmp.c: $(srcdir)/tsafememcmp.c $(std_unity_list) - $(run_unity) tsafememcmp.c run-tsafememcmp.c + $(run_unity) $< $@ ### @@ -499,7 +499,7 @@ test_tstotv_SOURCES = \ $(NULL) $(srcdir)/run-tstotv.c: $(srcdir)/tstotv.c $(std_unity_list) - $(run_unity) tstotv.c run-tstotv.c + $(run_unity) $< $@ ### @@ -510,7 +510,7 @@ test_tvtots_SOURCES = \ $(NULL) $(srcdir)/run-tvtots.c: $(srcdir)/tvtots.c $(std_unity_list) - $(run_unity) tvtots.c run-tvtots.c + $(run_unity) $< $@ ### @@ -520,7 +520,7 @@ test_uglydate_SOURCES = \ $(NULL) $(srcdir)/run-uglydate.c: $(srcdir)/uglydate.c $(std_unity_list) - $(run_unity) uglydate.c run-uglydate.c + $(run_unity) $< $@ ### @@ -530,7 +530,7 @@ test_vi64ops_SOURCES = \ $(NULL) $(srcdir)/run-vi64ops.c: $(srcdir)/vi64ops.c $(std_unity_list) - $(run_unity) vi64ops.c run-vi64ops.c + $(run_unity) $< $@ ### @@ -540,7 +540,7 @@ test_ymd2yd_SOURCES = \ $(NULL) $(srcdir)/run-ymd2yd.c: $(srcdir)/ymd2yd.c $(std_unity_list) - $(run_unity) ymd2yd.c run-ymd2yd.c + $(run_unity) $< $@ ### diff --git a/tests/ntpd/Makefile.am b/tests/ntpd/Makefile.am index 4c962f90a..1f6bff57e 100644 --- a/tests/ntpd/Makefile.am +++ b/tests/ntpd/Makefile.am @@ -7,7 +7,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = \ test-leapsec \ @@ -89,7 +89,7 @@ test_leapsec_SOURCES = \ $(NULL) $(srcdir)/run-leapsec.c: $(srcdir)/leapsec.c $(std_unity_list) - $(run_unity) leapsec.c run-leapsec.c + $(run_unity) $< $@ ### test_ntp_prio_q_CFLAGS = \ @@ -109,7 +109,7 @@ test_ntp_prio_q_SOURCES = \ $(NULL) $(srcdir)/run-ntp_prio_q.c: $(srcdir)/ntp_prio_q.c $(std_unity_list) - $(run_unity) ntp_prio_q.c run-ntp_prio_q.c + $(run_unity) $< $@ ### @@ -129,7 +129,7 @@ test_ntp_restrict_SOURCES = \ $(NULL) $(srcdir)/run-ntp_restrict.c: $(srcdir)/ntp_restrict.c $(std_unity_list) - $(run_unity) ntp_restrict.c run-ntp_restrict.c + $(run_unity) $< $@ @@ -150,7 +150,7 @@ test_rc_cmdlength_SOURCES = \ $(NULL) $(srcdir)/run-rc_cmdlength.c: $(srcdir)/rc_cmdlength.c $(std_unity_list) - $(run_unity) rc_cmdlength.c run-rc_cmdlength.c + $(run_unity) $< $@ ### @@ -167,7 +167,7 @@ test_ntp_signd_SOURCES = \ $(NULL) $(srcdir)/run-t-ntp_signd.c: $(srcdir)/t-ntp_signd.c $(std_unity_list) - $(run_unity) t-ntp_signd.c run-t-ntp_signd.c + $(run_unity) $< $@ ### test_ntp_scanner_CFLAGS = \ @@ -189,7 +189,7 @@ test_ntp_scanner_SOURCES = \ $(NULL) $(srcdir)/run-t-ntp_scanner.c: $(srcdir)/t-ntp_scanner.c $(std_unity_list) - $(run_unity) t-ntp_scanner.c run-t-ntp_scanner.c + $(run_unity) $< $@ TESTS = diff --git a/tests/ntpq/Makefile.am b/tests/ntpq/Makefile.am index 2ef96b032..6c1edd673 100644 --- a/tests/ntpq/Makefile.am +++ b/tests/ntpq/Makefile.am @@ -7,7 +7,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = \ test-ntpq \ @@ -61,7 +61,7 @@ test_ntpq_SOURCES = \ $(NULL) $(srcdir)/run-t-ntpq.c: $(srcdir)/t-ntpq.c $(std_unity_list) - $(run_unity) t-ntpq.c run-t-ntpq.c + $(run_unity) $< $@ TESTS = diff --git a/tests/sandbox/Makefile.am b/tests/sandbox/Makefile.am index 5182712df..da4828432 100644 --- a/tests/sandbox/Makefile.am +++ b/tests/sandbox/Makefile.am @@ -9,7 +9,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = \ first-test \ @@ -52,7 +52,7 @@ bug_2803_SOURCES = \ $(NULL) $(srcdir)/run-ut-2803.c: $(srcdir)/ut-2803.c $(std_unity_list) - $(run_unity) ut-2803.c run-ut-2803.c + $(run_unity) $< $@ BUILT_SOURCES += run-ut-2803.c first_test_SOURCES = \ @@ -61,7 +61,7 @@ first_test_SOURCES = \ $(NULL) $(srcdir)/run-uglydate.c: $(srcdir)/uglydate.c $(std_unity_list) - $(run_unity) uglydate.c run-uglydate.c + $(run_unity) $< $@ BUILT_SOURCES += run-uglydate.c second_test_SOURCES = \ @@ -70,7 +70,7 @@ second_test_SOURCES = \ $(NULL) $(srcdir)/run-modetoa.c: $(srcdir)/modetoa.c $(std_unity_list) - $(run_unity) modetoa.c run-modetoa.c + $(run_unity) $< $@ BUILT_SOURCES += run-modetoa.c diff --git a/tests/sec-2853/Makefile.am b/tests/sec-2853/Makefile.am index d13f4f0e9..24d4ad7f5 100644 --- a/tests/sec-2853/Makefile.am +++ b/tests/sec-2853/Makefile.am @@ -8,7 +8,7 @@ std_unity_list = \ $(abs_srcdir)/testconf.yml \ $(NULL) -run_unity = cd $(srcdir) && ruby $(std_unity_list) +run_unity = ruby $(std_unity_list) check_PROGRAMS = sec-2853 @@ -45,7 +45,7 @@ sec_2853_SOURCES = \ BUILT_SOURCES += $(srcdir)/run-sec-2853.c $(srcdir)/run-sec-2853.c: $(srcdir)/sec-2853.c $(std_unity_list) - $(run_unity) sec-2853.c run-sec-2853.c + $(run_unity) $< $@ # HMS: we may not need some of these: #noinst_HEADERS = ntpdtest.h \