Compare commits
9 Commits
06f537d314
...
c0cc718853
Author | SHA1 | Date |
---|---|---|
Harald Welte | c0cc718853 | |
Harald Welte | fdda7d8a6e | |
Harald Welte | 81eb605dc2 | |
Harald Welte | 7bbc391b69 | |
Harald Welte | f21a9a9a70 | |
Harald Welte | 60efa78b92 | |
Harald Welte | 680df9afc6 | |
Harald Welte | f00e46de1e | |
Michael Tuexen | ae3e1b3f5e |
2
dotguile
2
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 "/Users/tuexen/Documents/m3ua-testtool/")
|
||||
(define dir "")
|
||||
(define files (list "common.scm"
|
||||
"m3ua.scm"
|
||||
"m3ua-asp-tests.scm"
|
||||
|
|
|
@ -198,7 +198,7 @@
|
|||
(define (m3ua-asp-aspsm-o-002 tester-addr tester-port sut-addr sut-port)
|
||||
(let ((fd (m3ua-accept tester-addr tester-port)))
|
||||
(m3ua-wait-for-message fd m3ua-asp-up-message?)
|
||||
(m3ua-send-message fd 0 (m3ua-make-asp-active-ack-message (list)))
|
||||
(m3ua-send-message fd 0 (m3ua-make-asp-active-ack-message asp-active-ack-message-parameters))
|
||||
(let ((msg (m3ua-recv-message-with-timeout fd 2)))
|
||||
(close fd)
|
||||
(if (or (null? msg)
|
||||
|
|
|
@ -35,23 +35,23 @@
|
|||
|
||||
;;; $Id: m3ua-param-testtool.scm,v 1.5 2012/08/28 19:56:13 tuexen Exp $
|
||||
|
||||
;;; Define a transport address of the system under test
|
||||
(define sut-addr "127.0.0.1")
|
||||
(define sut-port 0)
|
||||
(define sut-port-1 0)
|
||||
(define sut-port-2 0)
|
||||
;;; Define a transport address of the system under test (osmo-stp)
|
||||
(define sut-addr "172.18.0.200")
|
||||
(define sut-port m3ua-port)
|
||||
(define sut-port-1 m3ua-port)
|
||||
(define sut-port-2 m3ua-port)
|
||||
|
||||
;;; Define the transport address of the tester
|
||||
(define tester-addr "127.0.0.1")
|
||||
(define tester-port m3ua-port)
|
||||
(define tester-addr "172.18.0.2")
|
||||
(define tester-port 3333)
|
||||
(define tester-port-1 3000)
|
||||
(define tester-port-2 3001)
|
||||
|
||||
;;; Define the point code of the IUT
|
||||
(define iut-pc 4001)
|
||||
(define iut-pc 1)
|
||||
|
||||
;;; Define the point code of the tester
|
||||
(define tester-pc 100)
|
||||
(define tester-pc 23)
|
||||
(define tester-pc-1 100)
|
||||
(define tester-pc-2 101)
|
||||
(define tester-invalid-pc 102)
|
||||
|
@ -79,7 +79,7 @@
|
|||
(define invalid-network-appearance 2)
|
||||
|
||||
;;; Define an routing context
|
||||
(define tester-rc-valid 1)
|
||||
(define tester-rc-valid 23)
|
||||
(define tester-rc-valid-1 1)
|
||||
(define tester-rc-valid-2 2)
|
||||
|
||||
|
@ -124,7 +124,7 @@
|
|||
;;;data-message-parameters
|
||||
|
||||
;;; Define parameter for DATA message
|
||||
(define rc 1)
|
||||
(define rc 23)
|
||||
(define opc 1)
|
||||
(define dpc 2)
|
||||
(define si 0)
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env tcsh
|
||||
|
||||
set timeout = 10
|
||||
set sleeptime = 1
|
||||
|
||||
set testcases = (m3ua-sgp-aspsm-v-001 \
|
||||
m3ua-sgp-aspsm-v-003 \
|
||||
m3ua-sgp-aspsm-v-005 \
|
||||
m3ua-sgp-aspsm-i-001 \
|
||||
m3ua-sgp-aspsm-i-002 \
|
||||
m3ua-sgp-aspsm-i-003 \
|
||||
m3ua-sgp-aspsm-i-004 \
|
||||
m3ua-sgp-aspsm-o-001 \
|
||||
m3ua-sgp-aspsm-o-003 \
|
||||
m3ua-sgp-aspsm-o-004 \
|
||||
m3ua-sgp-asptm-v-001 \
|
||||
m3ua-sgp-asptm-v-003 \
|
||||
m3ua-sgp-asptm-v-006 \
|
||||
m3ua-sgp-asptm-v-008 \
|
||||
m3ua-sgp-asptm-v-010 \
|
||||
m3ua-sgp-asptm-v-011 \
|
||||
m3ua-sgp-asptm-i-001 \
|
||||
m3ua-sgp-asptm-i-004 \
|
||||
m3ua-sgp-asptm-i-005 \
|
||||
m3ua-sgp-asptm-i-006 \
|
||||
m3ua-sgp-asptm-i-008 \
|
||||
m3ua-sgp-asptm-i-010 \
|
||||
m3ua-sgp-asptm-o-001 \
|
||||
m3ua-sgp-asptm-o-003 \
|
||||
m3ua-sgp-mtr-v-002-alternate \
|
||||
m3ua-sgp-mtr-v-003-alternate \
|
||||
m3ua-sgp-mtr-i-001 \
|
||||
m3ua-sgp-mtr-i-002 \
|
||||
m3ua-sgp-mtr-i-003 \
|
||||
m3ua-sgp-rkm-v-001 \
|
||||
m3ua-sgp-rkm-v-002 \
|
||||
m3ua-sgp-rkm-v-003 \
|
||||
)
|
||||
|
||||
foreach testcase ($testcases)
|
||||
(./runm3uatest -d . -t $timeout $testcase > /dev/tty) >& /dev/null
|
||||
sleep $sleeptime
|
||||
end
|
|
@ -16,6 +16,6 @@ testcases='m3ua-asp-aspsm-v-002
|
|||
|
||||
for testcase in $testcases
|
||||
do
|
||||
runm3uatest -t $timeout $testcase 2> /dev/null
|
||||
./runm3uatest -d . -t $timeout $testcase 2> /dev/null
|
||||
sleep $sleeptime
|
||||
done
|
||||
|
|
|
@ -16,6 +16,6 @@ testcases='m3ua-sgp-aspsm-v-003
|
|||
|
||||
for testcase in $testcases
|
||||
do
|
||||
runm3uatest -t $timeout $testcase 2> /dev/null
|
||||
./runm3uatest -d . -t $timeout $testcase 2> /dev/null
|
||||
sleep $sleeptime
|
||||
done
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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='m3ua'
|
||||
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])))
|
|
@ -0,0 +1,10 @@
|
|||
m3ua-sgp-aspsm-v-003
|
||||
m3ua-sgp-aspsm-i-001
|
||||
m3ua-sgp-aspsm-i-002
|
||||
m3ua-sgp-aspsm-i-003
|
||||
m3ua-sgp-aspsm-o-001
|
||||
m3ua-sgp-asptm-v-003
|
||||
m3ua-sgp-asptm-v-008
|
||||
m3ua-sgp-asptm-v-011
|
||||
m3ua-sgp-asptm-i-004
|
||||
m3ua-sgp-asptm-o-001
|
Loading…
Reference in New Issue