Compare commits
9 Commits
master
...
laforge/py
Author | SHA1 | Date |
---|---|---|
Harald Welte | f69fc380b8 | |
Harald Welte | a1cbac4453 | |
Harald Welte | 735518125a | |
Harald Welte | 050e4977b9 | |
Harald Welte | 77aacbc72d | |
Harald Welte | acf67d1ec4 | |
Michael Tuexen | 767e20ba7d | |
Michael Tuexen | 14073f34be | |
Michael Tuexen | fe670b16df |
2
dotguile
2
dotguile
|
@ -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"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env tcsh
|
#!/usr/bin/env sh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Michael Tuexen
|
# Copyright (c) 2011 Michael Tuexen
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -27,9 +27,12 @@
|
||||||
# $Id: run-some-sua-asp-tests,v 1.3 2011/03/20 16:53:06 tuexen Exp $
|
# $Id: run-some-sua-asp-tests,v 1.3 2011/03/20 16:53:06 tuexen Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set timeout = 10
|
timeout=10
|
||||||
set testcases = ( )
|
sleeptime=1
|
||||||
|
testcases=
|
||||||
|
|
||||||
foreach testcase ($testcases)
|
for testcase in $testcases
|
||||||
(runm3uatest -t $timeout $testcase > /dev/tty) >& /dev/null
|
do
|
||||||
end
|
run-sua-test -t $timeout $testcase 2> /dev/null
|
||||||
|
sleep $sleeptime
|
||||||
|
done
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env tcsh
|
#!/usr/bin/env sh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Michael Tuexen
|
# Copyright (c) 2011 Michael Tuexen
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -27,9 +27,37 @@
|
||||||
# $Id: run-some-sua-sgp-tests,v 1.3 2011/03/20 16:53:06 tuexen Exp $
|
# $Id: run-some-sua-sgp-tests,v 1.3 2011/03/20 16:53:06 tuexen Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set timeout = 10
|
timeout=10
|
||||||
set testcases = ( )
|
sleeptime=1
|
||||||
|
testcases='sua-sgp-aspsm-v-02
|
||||||
|
sua-sgp-aspsm-v-03
|
||||||
|
sua-sgp-aspsm-i-01
|
||||||
|
sua-sgp-aspsm-i-02
|
||||||
|
sua-sgp-aspsm-i-04
|
||||||
|
sua-sgp-aspsm-o-01
|
||||||
|
sua-sgp-aspsm-o-02
|
||||||
|
sua-sgp-aspsm-o-03
|
||||||
|
sua-sgp-asptm-v-01
|
||||||
|
sua-sgp-asptm-v-02
|
||||||
|
sua-sgp-asptm-v-04
|
||||||
|
sua-sgp-asptm-v-05
|
||||||
|
sua-sgp-asptm-v-06
|
||||||
|
sua-sgp-asptm-v-07
|
||||||
|
sua-sgp-asptm-i-01
|
||||||
|
sua-sgp-asptm-i-03
|
||||||
|
sua-sgp-asptm-i-04
|
||||||
|
sua-sgp-asptm-i-05
|
||||||
|
sua-sgp-asptm-i-06
|
||||||
|
sua-sgp-asptm-i-08
|
||||||
|
sua-sgp-asptm-o-01
|
||||||
|
sua-sgp-asptm-o-02
|
||||||
|
sua-sgp-mtr-i-01
|
||||||
|
sua-sgp-mtr-i-02
|
||||||
|
sua-sgp-mtr-i-03
|
||||||
|
sua-sgp-mtr-i-04'
|
||||||
|
|
||||||
foreach testcase ($testcases)
|
for testcase in $testcases
|
||||||
(runm3uatest -t $timeout $testcase > /dev/tty) >& /dev/null
|
do
|
||||||
end
|
./run-sua-test -d . -t $timeout $testcase 2> /dev/null
|
||||||
|
sleep $sleeptime
|
||||||
|
done
|
||||||
|
|
|
@ -36,10 +36,10 @@
|
||||||
#define TIMEOUT 0
|
#define TIMEOUT 0
|
||||||
#define COMMAND_LENGTH 2048
|
#define COMMAND_LENGTH 2048
|
||||||
|
|
||||||
#define RED(string) "\033[31m"string"\033[0m"
|
#define RED(string) isatty(fileno(stdout))?"\033[31m"string"\033[0m":string
|
||||||
#define GREEN(string) "\033[32m"string"\033[0m"
|
#define GREEN(string) isatty(fileno(stdout))?"\033[32m"string"\033[0m":string
|
||||||
#define YELLOW(string) "\033[33m"string"\033[0m"
|
#define YELLOW(string) isatty(fileno(stdout))?"\033[33m"string"\033[0m":string
|
||||||
#define BLUE(string) "\033[34m"string"\033[0m"
|
#define BLUE(string) isatty(fileno(stdout))?"\033[34m"string"\033[0m":string
|
||||||
|
|
||||||
char command_skel[] =
|
char command_skel[] =
|
||||||
"(load-from-path \"%s/.guile\")"
|
"(load-from-path \"%s/.guile\")"
|
||||||
|
@ -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,16 +94,18 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
execlp("/usr/local/bin/guile", "guile",
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
"-c", command,
|
execlp("/usr/local/bin/guile", "guile", "-L", dir, "-c", command, NULL);
|
||||||
(char *)0);
|
#else
|
||||||
|
execlp("/usr/bin/guile", "guile", "-L", dir, "-c", command, NULL);
|
||||||
|
#endif
|
||||||
fprintf(stderr, "%s\n", "Couln't start guile.");
|
fprintf(stderr, "%s\n", "Couln't start guile.");
|
||||||
}
|
}
|
||||||
printf("Test %-40.40s ", argv[optind]);
|
printf("Test %-40.40s ", argv[optind]);
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Alternative executor for m3ua tests suite by Michael Tuexen's nplab
|
||||||
|
# (C) 2017 by Harald Welte <laforge@gnumonks.org>
|
||||||
|
|
||||||
|
from optparse import OptionParser
|
||||||
|
import os, sys, signal, time
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
from junit_xml import TestSuite, TestCase
|
||||||
|
|
||||||
|
PROTO='sua'
|
||||||
|
GUILE='/usr/bin/guile'
|
||||||
|
COMMAND_SKEL="""
|
||||||
|
(load-from-path "%s/.guile")
|
||||||
|
(let ((test-name "%s"))
|
||||||
|
(if (defined? (string->symbol test-name))
|
||||||
|
(exit ((eval-string test-name)
|
||||||
|
tester-addr tester-port sut-addr sut-port))
|
||||||
|
(exit 254)))
|
||||||
|
""";
|
||||||
|
|
||||||
|
TEST='%s-test' % PROTO
|
||||||
|
|
||||||
|
def status2tc(testcase, exitstatus, time_passed=0, stdout=None, stderr=None):
|
||||||
|
tc = TestCase(testcase, TEST, time_passed, stdout, stderr)
|
||||||
|
if exitstatus == 0:
|
||||||
|
return tc
|
||||||
|
elif exitstatus == 1:
|
||||||
|
tc.add_failure_info('FAILED')
|
||||||
|
elif exitstatus == 2:
|
||||||
|
tc.add_error_info('UNKNOWN')
|
||||||
|
elif exitstatus == 252:
|
||||||
|
tc.add_error_info('TIMEOUT')
|
||||||
|
elif exitstatus == 253:
|
||||||
|
tc.add_skipped_info('NON-APPLICABLE')
|
||||||
|
elif exitstatus == 254:
|
||||||
|
tc.add_error_info('NON-EXISTENT')
|
||||||
|
elif exitstatus == 255:
|
||||||
|
tc.add_error_info("COULDN'T START GUILE")
|
||||||
|
else:
|
||||||
|
tc.add_error_info("BUG")
|
||||||
|
return tc
|
||||||
|
|
||||||
|
def signal_handler(signum, frame):
|
||||||
|
raise IOError("Timeout!")
|
||||||
|
|
||||||
|
def start_testcase(directory, testcase, timeout=0):
|
||||||
|
cmd = COMMAND_SKEL % (directory, testcase)
|
||||||
|
signal.signal(signal.SIGALRM, signal_handler)
|
||||||
|
signal.alarm(timeout)
|
||||||
|
before = time.time()
|
||||||
|
my_env = os.environ
|
||||||
|
my_env["GUILE_WARN_DEPRECATED"] = "no"
|
||||||
|
my_env["GUILE_AUTO_COMPILE"] = "0"
|
||||||
|
p = Popen([GUILE, '-L', directory, '-c', cmd], env=my_env, stdout=PIPE, stderr=PIPE)
|
||||||
|
try:
|
||||||
|
(tc_stdout, tc_stderr) = p.communicate()
|
||||||
|
returncode = p.returncode
|
||||||
|
except IOError:
|
||||||
|
tc_stdout = tc_stderr = None
|
||||||
|
returncode = 252
|
||||||
|
signal.alarm(0)
|
||||||
|
after = time.time()
|
||||||
|
return status2tc(testcase, returncode, after-before, tc_stdout, tc_stderr)
|
||||||
|
|
||||||
|
def parse_options():
|
||||||
|
parser = OptionParser(usage="usage: %prog [options] test-case-list.txt")
|
||||||
|
parser.add_option('-d', '--directory', dest='directory', metavar='DIR',
|
||||||
|
help='Directory where to look for .guile file',
|
||||||
|
default=os.environ['HOME'])
|
||||||
|
parser.add_option('-t', '--timeout', dest='timeout', metavar='TOUT',
|
||||||
|
help='Timeout for individual test case in sconds',
|
||||||
|
default=60, type='int')
|
||||||
|
parser.add_option('-s', '--sleep', dest='sleep', metavar='SLEEP',
|
||||||
|
help='Sleep for given amount of time in between tests',
|
||||||
|
default=0, type='float')
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if len(args) < 1:
|
||||||
|
parser.error('You must specify a test list file name')
|
||||||
|
|
||||||
|
return options, args
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(options, args) = parse_options()
|
||||||
|
|
||||||
|
with open(args[0]) as f:
|
||||||
|
cases = f.read().splitlines()
|
||||||
|
|
||||||
|
tcs = []
|
||||||
|
|
||||||
|
for c in cases:
|
||||||
|
res = start_testcase(options.directory, c, timeout=options.timeout)
|
||||||
|
tcs.append(res)
|
||||||
|
time.sleep(options.sleep)
|
||||||
|
|
||||||
|
ts = TestSuite(TEST, tcs)
|
||||||
|
print((TestSuite.to_xml_string([ts])))
|
|
@ -26,25 +26,25 @@
|
||||||
;;; $Id: sua-param-testtool-sgp.scm,v 1.2 2011/03/21 22:18:29 tuexen Exp $
|
;;; $Id: sua-param-testtool-sgp.scm,v 1.2 2011/03/21 22:18:29 tuexen Exp $
|
||||||
|
|
||||||
;;; Define a transport address of the system under test
|
;;; Define a transport address of the system under test
|
||||||
(define sut-addr "127.0.0.1")
|
(define sut-addr "172.18.0.200")
|
||||||
(define sut-port sua-port)
|
(define sut-port sua-port)
|
||||||
(define sut-port-1 sua-port)
|
(define sut-port-1 sua-port)
|
||||||
(define sut-port-2 (1+ sua-port))
|
(define sut-port-2 (1+ sua-port))
|
||||||
|
|
||||||
;;; Define the transport address of the tester
|
;;; Define the transport address of the tester
|
||||||
(define tester-addr "127.0.0.1")
|
(define tester-addr "172.18.0.3")
|
||||||
|
|
||||||
(define tester-port 0)
|
(define tester-port 0)
|
||||||
(define tester-port-1 3000)
|
(define tester-port-1 3000)
|
||||||
(define tester-port-2 3001)
|
(define tester-port-2 3001)
|
||||||
|
|
||||||
;;; Define the point code of the SUT
|
;;; Define the point code of the SUT
|
||||||
(define sut-pc 4001)
|
(define sut-pc 1)
|
||||||
;;; Define the SSN of the SUT
|
;;; Define the SSN of the SUT
|
||||||
(define sut-ssn 3)
|
(define sut-ssn 3)
|
||||||
|
|
||||||
;;; Define the point code of the tester
|
;;; Define the point code of the tester
|
||||||
(define tester-pc 100)
|
(define tester-pc 24)
|
||||||
(define tester-pc-1 100)
|
(define tester-pc-1 100)
|
||||||
(define tester-pc-2 101)
|
(define tester-pc-2 101)
|
||||||
(define tester-invalid-pc 102)
|
(define tester-invalid-pc 102)
|
||||||
|
@ -77,8 +77,8 @@
|
||||||
(define sccp-test-message (list))
|
(define sccp-test-message (list))
|
||||||
|
|
||||||
;;; Define traffic-type-mode
|
;;; Define traffic-type-mode
|
||||||
;;;(define traffic-mode sua-traffic-mode-type-override)
|
(define traffic-mode sua-traffic-mode-type-override)
|
||||||
(define traffic-mode sua-traffic-mode-type-loadshare)
|
;(define traffic-mode sua-traffic-mode-type-loadshare)
|
||||||
;;;(define traffic-mode sua-traffic-mode-type-broadcast)
|
;;;(define traffic-mode sua-traffic-mode-type-broadcast)
|
||||||
|
|
||||||
(define asp-up-message-parameters (list))
|
(define asp-up-message-parameters (list))
|
||||||
|
|
Loading…
Reference in New Issue