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 $
;;; 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"

View File

@ -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

View File

@ -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.");
}