From 61838bbff39828b037cdf9ac5dc40e0d1cca5eea Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 14 May 2017 22:23:23 +0200 Subject: [PATCH] run-sua-test: Avoid having to use a ~/.guile script Rather, we can specify the path in which the sua-testtool files are located using the '-d ...' command line argument of run-sua-test. --- dotguile | 2 +- run-some-sua-sgp-tests | 2 +- run-sua-test.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dotguile b/dotguile index 7ef8d22..2d51622 100644 --- a/dotguile +++ b/dotguile @@ -26,7 +26,7 @@ ;;; $Id: dotguile,v 1.1 2011/03/20 16:48:30 tuexen Exp $ ;;; Change the following line to reflect where the files are located. -(define dir "/Users/tuexen/Documents/sua-testtool/") +(define dir "") (define files (list "common.scm" "sua.scm" "sua-param-testtool-asp.scm" diff --git a/run-some-sua-sgp-tests b/run-some-sua-sgp-tests index a414b71..6c60cab 100755 --- a/run-some-sua-sgp-tests +++ b/run-some-sua-sgp-tests @@ -58,5 +58,5 @@ set testcases = ( sua-sgp-aspsm-v-01 \ ) foreach testcase ($testcases) - (run-sua-test -t $timeout $testcase > /dev/tty) >& /dev/null + (./run-sua-test -d . -t $timeout $testcase > /dev/tty) >& /dev/null end diff --git a/run-sua-test.c b/run-sua-test.c index f8a4e36..c21efb3 100644 --- a/run-sua-test.c +++ b/run-sua-test.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 fprintf(stderr, "%s\n", "Couln't start guile."); }