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.
This commit is contained in:
Harald Welte 2017-05-14 22:23:23 +02:00
parent 54bf03e8e1
commit 61838bbff3
3 changed files with 10 additions and 6 deletions

View File

@ -26,7 +26,7 @@
;;; $Id: dotguile,v 1.1 2011/03/20 16:48:30 tuexen Exp $ ;;; $Id: dotguile,v 1.1 2011/03/20 16:48:30 tuexen Exp $
;;; Change the following line to reflect where the files are located. ;;; 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" (define files (list "common.scm"
"sua.scm" "sua.scm"
"sua-param-testtool-asp.scm" "sua-param-testtool-asp.scm"

View File

@ -58,5 +58,5 @@ set testcases = ( sua-sgp-aspsm-v-01 \
) )
foreach testcase ($testcases) 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 end

View File

@ -71,10 +71,11 @@ main(int argc, char *argv[]) {
unsigned int timeout; unsigned int timeout;
int status, c; int status, c;
char command[COMMAND_LENGTH]; char command[COMMAND_LENGTH];
char *dir = getenv("HOME");
timeout = TIMEOUT; timeout = TIMEOUT;
while ((c = getopt(argc, argv, "t:")) != -1) { while ((c = getopt(argc, argv, "t:d:")) != -1) {
switch(c) { switch(c) {
case 'h': case 'h':
print_usage(); print_usage();
@ -83,6 +84,9 @@ main(int argc, char *argv[]) {
case 't': case 't':
timeout = (unsigned int)atoi(optarg); timeout = (unsigned int)atoi(optarg);
break; break;
case 'd':
dir = optarg;
break;
default: default:
print_usage(); print_usage();
return 1; return 1;
@ -90,7 +94,7 @@ main(int argc, char *argv[]) {
} }
if (optind == argc - 1) { if (optind == argc - 1) {
snprintf(command, COMMAND_LENGTH, command_skel, getenv("HOME"), argv[optind]); snprintf(command, COMMAND_LENGTH, command_skel, dir, argv[optind]);
} else { } else {
print_usage(); print_usage();
return 1; return 1;
@ -98,9 +102,9 @@ main(int argc, char *argv[]) {
if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
#if defined(__APPLE__) || defined(__FreeBSD__) #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 #else
execlp("/usr/bin/guile", "guile", "-c", command, NULL); execlp("/usr/bin/guile", "guile", "-L", dir, "-c", command, NULL);
#endif #endif
fprintf(stderr, "%s\n", "Couln't start guile."); fprintf(stderr, "%s\n", "Couln't start guile.");
} }