A Discrete-Event Network Simulator
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
64from __future__ import print_function
65
66import sys
67
68from TestBase import TestBaseClass
69
70
71def main(argv):
72 """
73 Prepares test cases and executes
74 """
75 test_cases = [
76 "",
77 "-h",
78 "--help",
79 "-b build/",
80 "--buildpath=build/",
81 "-c performance",
82 "--constrain=performance",
83 "-d",
84 "--duration",
85 "-e socket-options-ipv6",
86 "--example=socket-options-ipv6",
87 "-u",
88 "--update-data",
89 "-f EXTENSIVE",
90 "--fullness=EXTENSIVE",
91 "-g",
92 "--grind",
93 "-l",
94 "--list",
95 "-m",
96 "--multiple",
97 "-n",
98 "--no-build",
99 "-p first",
100 "--pyexample=first",
101 "-r",
102 "--retain",
103 "-s ns3-tcp-state",
104 "--suite=ns3-tcp-state",
105 "-t t_opt.txt",
106 "--text=t_opt.txt && rm t_opt.txt",
107 "-v",
108 "--verbose",
109 "-w t_opt.html && rm t_opt.html",
110 "--web=t_opt.html && rm t_opt.html",
111 "--html=t_opt.html && rm t_opt.html",
112 "-x t_opt.xml && rm t_opt.xml",
113 "--xml=t_opt.xml && rm t_opt.xml",
114 ]
115
116 configure_string = sys.executable + " ns3 configure --enable-tests --enable-examples"
117 clean_string = sys.executable + " ns3 clean"
118 cmd_execute_list = [
119 "%s && %s test.py %s && %s" % (configure_string, sys.executable, option, clean_string)
120 for option in test_cases
121 ]
122 runner = TestBaseClass(argv[1:], "Test suite for the ns-3 unit test runner", "test-py")
123 return runner.runtests(cmd_execute_list)
124
125
126if __name__ == "__main__":
127 sys.exit(main(sys.argv))
TestBaseClass class.
Definition: TestBase.py:61