From 70be6181871415f1e633745117b49a65f69994a2 Mon Sep 17 00:00:00 2001
From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de>
Date: Wed, 10 Jul 2013 15:29:28 +0000
Subject: [PATCH] test: no longer use the softIoc binary from base

Instead, we use teh same binary we produce for the test case, and
add an extra switch -t that enables running the sequencer program.
---
 test/validate/Makefile        |  7 ++-----
 test/validate/makeTestfile.pl | 10 +++++-----
 test/validate/seqMain.c       | 14 ++++++++++++--
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/test/validate/Makefile b/test/validate/Makefile
index cbf42192..238f53a3 100644
--- a/test/validate/Makefile
+++ b/test/validate/Makefile
@@ -115,14 +115,11 @@ vxTestHarness.dbd$(DEP):
 	@echo "$(COMMON_DIR)/vxTestHarness.dbd: ../Makefile" > $@
 endif
 
-SOFTIOC=$(EPICS_BASE_BIN)/softIoc$(HOSTEXE)
-SOFTDBD=$(EPICS_BASE)/dbd/softIoc.dbd
-
 $(REGRESSION_TESTS_WITH_DB:%=%Ioc.t): %Ioc.t: %$(EXE) ../makeTestfile.pl
-	$(PERL) ../makeTestfile.pl $@ $* $< ioc $(SOFTIOC) $(SOFTDBD) $(USE_VALGRIND)
+	$(PERL) ../makeTestfile.pl $@ $* $< ioc $(USE_VALGRIND)
 
 $(REGRESSION_TESTS:%=%.t): %.t: %$(EXE) ../makeTestfile.pl
-	$(PERL) ../makeTestfile.pl $@ $* $< noioc $(SOFTIOC) $(SOFTDBD) $(USE_VALGRIND)
+	$(PERL) ../makeTestfile.pl $@ $* $< noioc $(USE_VALGRIND)
 
 norace.i race.i: ../raceCommon.st
 
diff --git a/test/validate/makeTestfile.pl b/test/validate/makeTestfile.pl
index e63a17ae..38582e42 100644
--- a/test/validate/makeTestfile.pl
+++ b/test/validate/makeTestfile.pl
@@ -23,7 +23,7 @@ use strict;
 
 my $valgrind = "";
 
-my ($target, $stem, $exe, $ioc, $softioc, $softdbd, $valgrind_path) = @ARGV;
+my ($target, $stem, $exe, $ioc, $valgrind_path) = @ARGV;
 
 if ($valgrind_path) {
   `$valgrind_path -h`;
@@ -51,19 +51,19 @@ if ($ioc eq "ioc") {
 my $pid = fork();
 die "fork failed: $err" unless defined($pid);
 if (!$pid) {
-  exec("$softioc -D $softdbd -S -d $db");
+  exec("./$exe -S -d $db");
   die "exec failed: $err";
 }
-system("$valgrind./$exe -S");
+system("$valgrind./$exe -S -t");
 $killit;
 EOF
 } elsif (-r "$db") {
   print $OUT <<EOF;
-exec "$valgrind./$exe -S -d $db" or die "exec failed: $err";
+exec "$valgrind./$exe -S -t -d $db" or die "exec failed: $err";
 EOF
 } else {
   print $OUT <<EOF;
-exec "$valgrind./$exe -S" or die "exec failed: $err";
+exec "$valgrind./$exe -S -t" or die "exec failed: $err";
 EOF
 }
 
diff --git a/test/validate/seqMain.c b/test/validate/seqMain.c
index 3a578cd8..3396f374 100644
--- a/test/validate/seqMain.c
+++ b/test/validate/seqMain.c
@@ -88,7 +88,8 @@ int main(int argc, char *argv[])
     char *macros = NULL;
     int startIocsh = 1;	/* default = start shell */
     int loadedDb = 0;
-    
+    int startSeqProgram = 0;
+
     errlogSetSevToLog(errlogFatal+1);
 
     arg0 = strrchr(*argv, '/');
@@ -153,6 +154,10 @@ int main(int argc, char *argv[])
 	case 's':
 	    break;
 	
+	case 't':
+            startSeqProgram = 1;
+	    break;
+	
 	default:
 	    printf("%s: option '%s' not recognized\n", arg0, *argv);
 	    usage(EXIT_FAILURE);
@@ -180,6 +185,10 @@ int main(int argc, char *argv[])
 	case 's':
 	    break;
 	
+	case 't':
+            startSeqProgram = 1;
+	    break;
+	
 	default:
 	    printf("%s: option '%s' not recognized\n", arg0, *argv);
 	    usage(EXIT_FAILURE);
@@ -193,7 +202,8 @@ int main(int argc, char *argv[])
 	epicsThreadSleep(0.2);
     }
 
-    seq(&PROG_NAME, macros, 0);
+    if (startSeqProgram)
+        seq(&PROG_NAME, macros, 0);
     
     /* run user's startup script */
     if (argc>0) {
-- 
GitLab