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 portability 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'
,
88
'--fullness=EXTENSIVE'
,
89
'-g'
,
90
'--grind'
,
91
'-l'
,
92
'--list'
,
93
'-m'
,
94
'--multiple'
,
95
'-n'
,
96
'--no-build'
,
97
'-p first'
,
98
'--pyexample=first'
,
99
'-r'
,
100
'--retain'
,
101
'-s ns3-tcp-state'
,
102
'--suite=ns3-tcp-state'
,
103
'-t t_opt.txt'
,
104
'--text=t_opt.txt && rm t_opt.txt'
,
105
'-v'
,
106
'--verbose'
,
107
'-w t_opt.html && rm t_opt.html'
,
108
'--web=t_opt.html && rm t_opt.html'
,
109
'--html=t_opt.html && rm t_opt.html'
,
110
'-x t_opt.xml && rm t_opt.xml'
,
111
'--xml=t_opt.xml && rm t_opt.xml'
,
112
]
113
114
configure_string = sys.executable +
' ns3 configure --enable-tests --enable-examples'
115
clean_string = sys.executable +
' ns3 clean'
116
cmd_execute_list = [
'%s && %s test.py %s && %s'
% (configure_string, sys.executable, option, clean_string)
for
option
in
test_cases]
117
runner =
TestBaseClass
(argv[1:],
"Test suite for the ns-3 unit test runner"
,
'test-py'
)
118
return
runner.runtests(cmd_execute_list)
119
120
if
__name__ ==
'__main__'
:
121
sys.exit(main(sys.argv))
TestBase.TestBaseClass
TestBaseClass class.
Definition:
TestBase.py:52
utils
tests
test-test.py
Generated on Wed Sep 27 2023 18:44:53 for ns-3 by
1.9.6