A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
test-test.py
Go to the documentation of this file.
1
#! /usr/bin/env python3
2
#
3
# Copyright (c) 2014 Siddharth Santurkar
4
#
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License version 2 as
7
# published by the Free Software Foundation;
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
#
18
19
# NOTE: Run this script with the Python3 interpreter if the python3 compatibility
20
# of the ns-3 unit test runner needs to be tested.
21
22
# The following options of test.py are being tested for poratability by this script.
23
# To see the options supported by this script, run with the -h option on the command line
24
#
25
# -h, --help show this help message and exit
26
# -b BUILDPATH, --buildpath=BUILDPATH
27
# specify the path where ns-3 was built (defaults to the
28
# build directory for the current variant)
29
# -c KIND, --constrain=KIND
30
# constrain the test-runner by kind of test
31
# -d, --duration print the duration of each test suite and example
32
# -e EXAMPLE, --example=EXAMPLE
33
# specify a single example to run (no relative path is
34
# needed)
35
# -u, --update-data If examples use reference data files, get them to re-
36
# generate them
37
# -f FULLNESS, --fullness=FULLNESS
38
# choose the duration of tests to run: QUICK, EXTENSIVE,
39
# or TAKES_FOREVER, where EXTENSIVE includes QUICK and
40
# TAKES_FOREVER includes QUICK and EXTENSIVE (only QUICK
41
# tests are run by default)
42
# -g, --grind run the test suites and examples using valgrind
43
# -k, --kinds print the kinds of tests available
44
# -l, --list print the list of known tests
45
# -m, --multiple report multiple failures from test suites and test
46
# cases
47
# -n, --no-build do not run ns3 before starting testing
48
# -p PYEXAMPLE, --pyexample=PYEXAMPLE
49
# specify a single python example to run (with relative
50
# path)
51
# -r, --retain retain all temporary files (which are normally
52
# deleted)
53
# -s TEST-SUITE, --suite=TEST-SUITE
54
# specify a single test suite to run
55
# -t TEXT-FILE, --text=TEXT-FILE
56
# write detailed test results into TEXT-FILE.txt
57
# -v, --verbose print progress and informational messages
58
# -w HTML-FILE, --web=HTML-FILE, --html=HTML-FILE
59
# write detailed test results into HTML-FILE.html
60
# -x XML-FILE, --xml=XML-FILE
61
# write detailed test results into XML-FILE.xml
62
63
64
65
from
__future__
import
print_function
66
from
TestBase
import
TestBaseClass
67
import
sys
68
69
def
main(argv):
70
"""
71
Prepares test cases
and
executes
72
"""
73
test_cases = [
74
''
,
75
'-h'
,
76
'--help'
,
77
'-b build/'
,
78
'--buildpath=build/'
,
79
'-c performance'
,
80
'--constrain=performance'
,
81
'-d'
,
82
'--duration'
,
83
'-e socket-options-ipv6'
,
84
'--example=socket-options-ipv6'
,
85
'-u'
,
86
'--update-data'
,
87
'-f EXTENSIVE --fullness=EXTENSIVE'
88
'-g'
,
89
'--grind'
,
90
'-l'
,
91
'--list'
,
92
'-m'
,
93
'--multiple'
,
94
'-n'
,
95
'--no-build'
,
96
'-p first'
,
97
'--pyexample=first'
,
98
'-r'
,
99
'--retain'
,
100
'-s ns3-tcp-interoperability'
,
101
'--suite=ns3-tcp-interoperability'
,
102
'-t t_opt.txt'
,
103
'--text=t_opt.txt && rm -rf t_opt.txt'
,
104
'-v'
,
105
'--verbose'
,
106
'-w t_opt.html && rm -rf t_opt.html'
,
107
'--web=t_opt.html && rm -rf t_opt.html'
,
108
'--html=t_opt.html && rm -rf t_opt.html'
,
109
'-x t_opt.xml && rm -rf t_opt.xml'
,
110
'--xml=t_opt.xml && rm -rf t_opt.xml'
,
111
]
112
113
configure_string = sys.executable +
' ns3 configure --enable-tests --enable-examples'
114
clean_string = sys.executable +
' ns3 clean'
115
cmd_execute_list = [
'%s && %s test.py %s && %s'
% (configure_string, sys.executable, option, clean_string)
for
option
in
test_cases]
116
runner =
TestBaseClass
(argv[1:],
"Test suite for the ns-3 unit test runner"
,
'test-py'
)
117
return
runner.runtests(cmd_execute_list)
118
119
if
__name__ ==
'__main__'
:
120
sys.exit(main(sys.argv))
TestBase.TestBaseClass
TestBaseClass class.
Definition:
TestBase.py:52
utils
tests
test-test.py
Generated on Sun Jul 2 2023 18:22:20 for ns-3 by
1.9.6