From 5e70f7f9054729612b998e4e55bd8827e89a9603 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 14 May 2017 22:12:52 +0200 Subject: runm3uatest: Avoid having to use a ~/.guile script Rather, we can specify the path in which the m3ua-testtool files are located using the '-d ...' command line argument of runm3uatest --- .guile | 1 + dotguile | 2 +- run-all-sgp-tests | 2 +- run-some-asp-tests | 2 +- run-some-sgp-tests | 2 +- runm3uatest.c | 12 ++++++++---- 6 files changed, 13 insertions(+), 8 deletions(-) create mode 120000 .guile diff --git a/.guile b/.guile new file mode 120000 index 0000000..8c7a106 --- /dev/null +++ b/.guile @@ -0,0 +1 @@ +dotguile \ No newline at end of file diff --git a/dotguile b/dotguile index fde813a..4270588 100644 --- a/dotguile +++ b/dotguile @@ -26,7 +26,7 @@ ;;; $Id: dotguile,v 1.1 2012/08/26 21:06:27 tuexen Exp $ ;;; Change the following line to reflect where the files are located. -(define dir "/home/laforge/projects/git/m3ua-testtool/") +(define dir "") (define files (list "common.scm" "m3ua.scm" "m3ua-asp-tests.scm" diff --git a/run-all-sgp-tests b/run-all-sgp-tests index 08e3c86..7f6ea37 100755 --- a/run-all-sgp-tests +++ b/run-all-sgp-tests @@ -38,6 +38,6 @@ set testcases = (m3ua-sgp-aspsm-v-001 \ ) foreach testcase ($testcases) - (runm3uatest -t $timeout $testcase > /dev/tty) >& /dev/null + (./runm3uatest -d . -t $timeout $testcase > /dev/tty) >& /dev/null sleep $sleeptime end diff --git a/run-some-asp-tests b/run-some-asp-tests index 8052f54..fadd2af 100755 --- a/run-some-asp-tests +++ b/run-some-asp-tests @@ -15,6 +15,6 @@ set testcases = (m3ua-asp-aspsm-v-002 \ m3ua-asp-mtr-i-002 ) foreach testcase ($testcases) - (runm3uatest -t $timeout $testcase > /dev/tty) >& /dev/null + (./runm3uatest -d . -t $timeout $testcase > /dev/tty) >& /dev/null sleep $sleeptime end diff --git a/run-some-sgp-tests b/run-some-sgp-tests index f13e08a..ace55d7 100755 --- a/run-some-sgp-tests +++ b/run-some-sgp-tests @@ -15,6 +15,6 @@ set testcases = (m3ua-sgp-aspsm-v-003 \ m3ua-sgp-asptm-o-001) foreach testcase ($testcases) - (runm3uatest -t $timeout $testcase > /dev/tty) >& /dev/null + (./runm3uatest -d . -t $timeout $testcase > /dev/tty) >& /dev/null sleep $sleeptime end diff --git a/runm3uatest.c b/runm3uatest.c index 8b7773e..863759a 100644 --- a/runm3uatest.c +++ b/runm3uatest.c @@ -71,10 +71,11 @@ main(int argc, char *argv[]) { unsigned int timeout; int status, c; char command[COMMAND_LENGTH]; + char *dir = getenv("HOME"); timeout = TIMEOUT; - while ((c = getopt(argc, argv, "t:")) != -1) { + while ((c = getopt(argc, argv, "t:d:")) != -1) { switch(c) { case 'h': print_usage(); @@ -83,6 +84,9 @@ main(int argc, char *argv[]) { case 't': timeout = (unsigned int)atoi(optarg); break; + case 'd': + dir = optarg; + break; default: print_usage(); return (1); @@ -90,7 +94,7 @@ main(int argc, char *argv[]) { } if (optind == argc - 1) { - snprintf(command, COMMAND_LENGTH, command_skel, getenv("HOME"), argv[optind]); + snprintf(command, COMMAND_LENGTH, command_skel, dir, argv[optind]); } else { print_usage(); return (1); @@ -98,9 +102,9 @@ main(int argc, char *argv[]) { if ((pid = fork()) == 0) { #if defined(__APPLE__) || defined(__FreeBSD__) - execlp("/usr/local/bin/guile", "guile", "-c", command, NULL); + execlp("/usr/local/bin/guile", "guile", "-L", dir, "-c", command, NULL); #else - execlp("/usr/bin/guile", "guile", "-c", command, NULL); + execlp("/usr/bin/guile", "guile", "-L", dir, "-c", command, NULL); #endif return (255); } -- cgit v1.2.3