View | Details | Raw Unified | Return to bug 480
Collapse All | Expand All

(-)a/regression.py (-145 / +161 lines)
 Lines 9-14    Link Here 
9
import Build
9
import Build
10
import Options
10
import Options
11
import Utils
11
import Utils
12
import Task
12
13
13
# local modules
14
# local modules
14
import wutils
15
import wutils
 Lines 20-125    Link Here 
20
    else:
21
    else:
21
        return open("/dev/null", "w")
22
        return open("/dev/null", "w")
22
23
23
24
### Regression testing
25
class Regression(object):
26
    def __init__(self, testdir, reference_traces):
27
        self.testdir = testdir
28
        self.reference_traces = reference_traces
29
        self.env = Build.bld.env
30
31
    def run_test(self, verbose, generate, testName, arguments=[], pyscript=None, refTestName=None):
32
        """
33
        @param verbose: enable verbose execution
34
35
        @param generate: generate new traces instead of comparing with the reference
36
37
        @param testName: name of the test
38
39
        @arguments: list of extra parameters to pass to the program to be tested
40
41
        @pyscript: if not None, the test is written in Python and this
42
        parameter contains the path to the python script, relative to
43
        the project root dir
44
45
        @param refTestName: if not None, this is the name of the directory under refDirName
46
        that contains the reference traces. Otherwise "refDirname/testName + .ref" is used.
47
48
        """
49
        if not isinstance(arguments, list):
50
            raise TypeError
51
        
52
        if refTestName is None:
53
            refTestDirName = os.path.join(self.reference_traces, (testName + ".ref"))
54
        else:
55
            refTestDirName = os.path.join(self.reference_traces, refTestName)
56
57
        if not os.path.exists(self.reference_traces):
58
            print"No reference trace repository"
59
            return 1
60
61
        if generate:
62
            if not os.path.exists(refTestDirName):
63
                print "creating new " + refTestDirName
64
                os.mkdir(refTestDirName)
65
66
            if pyscript is None:
67
                tmpl = "%s"
68
                for arg in arguments:
69
                    tmpl = tmpl + " " + arg
70
                wutils.run_program(testName, tmpl, cwd=refTestDirName)
71
            else:
72
                argv = [self.env['PYTHON'], os.path.join(Options.cwd_launch, *os.path.split(pyscript))] + arguments
73
                wutils.run_argv(argv, cwd=refTestDirName)
74
            print "Remember to commit " + refTestDirName
75
            return 0
76
        else:
77
            if not os.path.exists(refTestDirName):
78
                print "Cannot locate reference traces in " + refTestDirName
79
                return 1
80
81
            if refTestName is None:
82
                traceDirName = testName + ".ref"
83
            else:
84
                traceDirName = refTestName
85
            traceDirName = os.path.join('regression', 'traces', traceDirName)
86
87
            try:
88
                shutil.rmtree(traceDirName)
89
            except OSError:
90
                pass
91
            os.mkdir(traceDirName)
92
93
            if pyscript is None:
94
                wutils.run_program(testName,
95
                                   command_template=wutils.get_command_template(*arguments),
96
                                   cwd=traceDirName)
97
            else:
98
                argv = [self.env['PYTHON'], os.path.join('..', '..', '..', *os.path.split(pyscript))] + arguments
99
                wutils.run_argv(argv, cwd=traceDirName)
100
101
            if verbose:
102
                #diffCmd = "diff traces " + refTestDirName + " | head"
103
                diffCmd = subprocess.Popen([self.env['DIFF'], traceDirName, refTestDirName],
104
                                           stdout=subprocess.PIPE)
105
                headCmd = subprocess.Popen("head", stdin=diffCmd.stdout)
106
                rc2 = headCmd.wait()
107
                diffCmd.stdout.close()
108
                rc1 = diffCmd.wait()
109
                rc = rc1 or rc2
110
            else:
111
                rc = subprocess.Popen([self.env['DIFF'], traceDirName, refTestDirName], stdout=dev_null()).wait()
112
            if rc:
113
                print "----------"
114
                print "Traces differ in test: test-" + testName
115
                print "Reference traces in directory: regression/" + refTestDirName
116
                print "Traces in directory: traces"
117
                print "Rerun regression test as: " + \
118
                    "\"./waf --regression --regression-tests=test-" + testName + "\""
119
                print "Then do \"diff -u regression/" + refTestDirName + " regression/" + traceDirName +\
120
                    "\" for details"
121
                print "----------"
122
            return rc
123
24
124
def _find_tests(testdir):
25
def _find_tests(testdir):
125
    """Return a list of test modules in the test directory
26
    """Return a list of test modules in the test directory
 Lines 136-142    Link Here 
136
    tests.sort()
37
    tests.sort()
137
    return tests
38
    return tests
138
39
139
def run_regression(reference_traces):
40
41
class regression_test_task(Task.TaskBase):
42
    after = 'cc cxx'
43
    color = 'BLUE'
44
45
    def __init__(self, env, test_name, test_scripts_dir, build_traces_dir, reference_traces):
46
        super(regression_test_task, self).__init__()
47
        self.env = env
48
        self.test_name = test_name
49
        self.test_scripts_dir = test_scripts_dir
50
        self.build_traces_dir = build_traces_dir
51
        self.reference_traces_dir = reference_traces
52
53
    def __str__(self):
54
        return 'regression-test (%s)\n' % self.test_name
55
56
    def run(self):
57
        """Run a single test"""
58
        sys.path.insert(0, self.test_scripts_dir)
59
        try:
60
            mod = __import__(self.test_name, globals(), locals(), [])
61
        finally:
62
            sys.path.remove(self.test_scripts_dir)
63
64
        assert self.test_name.startswith('test-')
65
        short_name = self.test_name[len('test-'):]
66
67
        trace_dir_name = getattr(mod, "trace_dir_name", None)
68
        if trace_dir_name is None:
69
            trace_dir_name = "%s.ref" % short_name
70
        trace_output_path = os.path.join(self.build_traces_dir, trace_dir_name)
71
        reference_traces_path = os.path.join(self.reference_traces_dir, trace_dir_name)
72
73
        if hasattr(mod, 'get_arguments'):
74
            arguments = mod.get_arguments(self.env, '..')
75
        else:
76
            arguments = getattr(mod, "arguments", [])
77
78
        pyscript = getattr(mod, "pyscript", None)
79
        if pyscript:
80
            is_pyscript = True
81
            program = pyscript
82
        else:
83
            is_pyscript = False
84
            program = getattr(mod, "program", short_name)
85
86
        if hasattr(mod, 'may_run'):
87
            reason_cannot_run = mod.may_run(self.env)
88
        else:
89
            reason_cannot_run = None
90
        if reason_cannot_run:
91
            print "SKIP %s (%s)" % (self.test_name, reason_cannot_run)
92
            self.result = None
93
            return 0
94
95
        if Options.options.regression_generate:
96
            # clean the target dir
97
            shutil.rmtree(reference_traces_path, ignore_errors=True)
98
            os.makedirs(reference_traces_path)
99
            result = self.run_reference_generate(reference_traces_path, program, arguments, is_pyscript)
100
            if result == 0:
101
                print "GENERATE " + self.test_name
102
            else:
103
                print "GENERATE FAIL " + self.test_name
104
        else:
105
            # clean the target dir
106
            shutil.rmtree(trace_output_path, ignore_errors=True)
107
            os.makedirs(trace_output_path)
108
            # run it
109
            result = self.run_reference_test(reference_traces_path, trace_output_path, program, arguments, is_pyscript)
110
            if result == 0:
111
                print "PASS " + self.test_name
112
            else:
113
                print "FAIL " + self.test_name
114
        self.result = result
115
        return 0
116
117
    def run_reference_test(self, reference_traces_path, trace_output_path, program, arguments, is_pyscript):
118
        if not os.path.exists(reference_traces_path):
119
            print "Cannot locate reference traces in " + reference_traces_path
120
            return 1
121
122
        if is_pyscript:
123
            script = os.path.abspath(os.path.join('..', *os.path.split(program)))
124
            argv = [self.env['PYTHON'], script] + arguments
125
            wutils.run_argv(argv, cwd=trace_output_path)
126
        else:
127
            wutils.run_program(program,
128
                               command_template=wutils.get_command_template(*arguments),
129
                               cwd=trace_output_path)
130
131
        if Options.options.verbose:
132
            #diffCmd = "diff traces " + refTestDirName + " | head"
133
            diffCmd = subprocess.Popen([self.env['DIFF'], trace_output_path, reference_traces_path],
134
                                       stdout=subprocess.PIPE)
135
            headCmd = subprocess.Popen("head", stdin=diffCmd.stdout)
136
            rc2 = headCmd.wait()
137
            diffCmd.stdout.close()
138
            rc1 = diffCmd.wait()
139
            rc = rc1 or rc2
140
        else:
141
            rc = subprocess.Popen([self.env['DIFF'], trace_output_path, reference_traces_path], stdout=dev_null()).wait()
142
        if rc:
143
            print "----------"
144
            print "Traces differ in test: ", self.test_name
145
            print "Reference traces in directory: " + reference_traces_path
146
            print "Traces in directory: " + trace_output_path
147
            print "Run the following command for details:"
148
            print "\tdiff -u %s %s" % (reference_traces_path, trace_output_path)
149
            print "----------"
150
        return rc
151
152
153
    def run_reference_generate(self, trace_output_path, program, arguments, is_pyscript):
154
        if is_pyscript:
155
            script = os.path.abspath(os.path.join('..', *os.path.split(program)))
156
            argv = [self.env['PYTHON'], script] + arguments
157
            retval = wutils.run_argv(argv, cwd=trace_output_path)
158
        else:
159
            retval = wutils.run_program(program,
160
                                        command_template=wutils.get_command_template(*arguments),
161
                                        cwd=trace_output_path)
162
        return retval
163
164
165
class regression_test_collector_task(Task.TaskBase):
166
    after = 'regression_test_task'
167
    color = 'BLUE'
168
169
    def __init__(self, test_tasks):
170
        super(regression_test_collector_task, self).__init__()
171
        self.test_tasks = test_tasks
172
173
    def __str__(self):
174
        return 'regression-test-collector\n'
175
176
    def run(self):
177
        failed_tests = [test for test in self.test_tasks if test.result is not None and test.result != 0]
178
        skipped_tests = [test for test in self.test_tasks if test.result is None]
179
        print "Regression testing summary:"
180
        if skipped_tests:
181
            print "SKIP: %i of %i tests have been skipped (%s)" % (
182
                len(skipped_tests), len(self.test_tasks),
183
                ', '.join([test.test_name for test in skipped_tests]))
184
        if failed_tests:
185
            print "FAIL: %i of %i tests have failed (%s)" % (
186
                len(failed_tests), len(self.test_tasks),
187
                ', '.join([test.test_name for test in failed_tests]))
188
            return 1
189
        else:
190
            print "PASS: %i of %i tests passed" % (len(self.test_tasks) - len(skipped_tests),
191
                                                   len(self.test_tasks))
192
            return 0
193
194
def run_regression(bld, reference_traces):
140
    """Execute regression tests.  Called with cwd set to the 'regression' subdir of ns-3.
195
    """Execute regression tests.  Called with cwd set to the 'regression' subdir of ns-3.
141
196
142
    @param reference_traces: reference traces directory.
197
    @param reference_traces: reference traces directory.
 Lines 148-204    Link Here 
148
        print "Tests directory does not exist"
203
        print "Tests directory does not exist"
149
        sys.exit(3)
204
        sys.exit(3)
150
205
151
    sys.path.append(testdir)
152
    sys.modules['tracediff'] = Regression(testdir, reference_traces)
153
154
    if Options.options.regression_tests:
206
    if Options.options.regression_tests:
155
        tests = Options.options.regression_tests.split(',')
207
        tests = Options.options.regression_tests.split(',')
156
    else:
208
    else:
157
        tests = _find_tests(testdir)
209
        tests = _find_tests(testdir)
158
210
159
    print "========== Running Regression Tests =========="
160
    env = Build.bld.env
161
162
    if not os.path.exists(reference_traces):
211
    if not os.path.exists(reference_traces):
163
        print "Reference traces directory (%s) does not exist" % reference_traces
212
        print "Reference traces directory (%s) does not exist" % reference_traces
164
        return 3
213
        return 3
165
    
214
    
166
    bad = []
215
    test_scripts_dir = bld.path.find_dir('regression/tests').abspath()
167
216
    build_traces_dir = bld.path.find_dir('regression/traces').abspath(bld.env)
217
    tasks = []
168
    for test in tests:
218
    for test in tests:
169
        try:
219
        tasks.append(regression_test_task(bld.env, test, test_scripts_dir, build_traces_dir, reference_traces))
170
            result = _run_regression_test(test)
220
    regression_test_collector_task(tasks)
171
            if result == 0:
172
                if Options.options.regression_generate:
173
                    print "GENERATE " + test
174
                else:
175
                    print "PASS " + test
176
            else:
177
                bad.append(test)
178
                print "FAIL " + test
179
        except NotImplementedError:
180
            print "SKIP " + test            
181
182
    return (len(bad) > 0)
183
184
185
def _run_regression_test(test):
186
    """Run a single test.
187
188
    Arguments:
189
    test -- the name of the test
190
    """
191
    traces_dir = os.path.join("regression", "traces")
192
    if os.path.exists(traces_dir):
193
        files = os.listdir(traces_dir)
194
        for file in files:
195
            if file == '.' or file == '..':
196
                continue
197
            shutil.rmtree(os.path.join("traces", file), ignore_errors=True)
198
    else:
199
        os.mkdir(traces_dir)
200
    
201
    mod = __import__(test, globals(), locals(), [])
202
    return mod.run(verbose=(Options.options.verbose > 0),
203
                   generate=Options.options.regression_generate)
204
(-)a/regression/tests/test-csma-bridge.py (-10 / +8 lines)
 Lines 2-16    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
5
import os.path
6
import sys
7
import tracediff
8
6
9
def run(verbose, generate):
7
def may_run(env):
10
    """Execute a test."""
8
    """Returns 0 when it can run, return non-zero or string (reason) when it cannot run"""
11
    if tracediff.env['ENABLE_PYTHON_BINDINGS']:
9
    if env['ENABLE_PYTHON_BINDINGS']:
12
        return tracediff.run_test(verbose, generate,
10
        return 0
13
                                  "csma-bridge", pyscript=os.path.join('examples', 'csma-bridge.py'))
14
    else:
11
    else:
15
        print >> sys.stderr, "Skipping csma-bridge: Python bindings not available."
12
        return "Python bindings not available."
16
        raise NotImplementedError
13
14
pyscript = os.path.join('examples', 'csma-bridge.py')
(-)a/regression/tests/test-csma-broadcast.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-broadcast")
(-)a/regression/tests/test-csma-multicast.py (-9 lines)
 Lines 1-12    Link Here 
1
#! /usr/bin/env python
1
#! /usr/bin/env python
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-multicast")
(-)a/regression/tests/test-csma-one-subnet.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-one-subnet")
(-)a/regression/tests/test-csma-packet-socket.py (-9 lines)
 Lines 2-13    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate,
13
        "csma-packet-socket")
(-)a/regression/tests/test-csma-ping.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-ping")
(-)a/regression/tests/test-csma-raw-ip-socket.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-raw-ip-socket")
(-)a/regression/tests/test-csma-star.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "csma-star")
(-)a/regression/tests/test-dynamic-global-routing.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "dynamic-global-routing")
(-)a/regression/tests/test-global-routing-slash32.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "global-routing-slash32")
(-)a/regression/tests/test-ns2-mob.py (-7 / +8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
5
import os.path
6
import shutil
7
import tracediff
8
6
9
def run(verbose, generate):
7
program = "main-ns2-mob"
10
    """Execute a test."""
8
11
    arguments = ["../../../samples/ns2-mob.tr", "out.tr"]
9
def get_arguments(env, top_dir):
12
    return tracediff.run_test(verbose, generate, "main-ns2-mob", arguments=arguments)
10
    ns2_tracefile = os.path.abspath(os.path.join(top_dir, "samples", "ns2-mob.tr"))
11
    return [ns2_tracefile, "out.tr"]
12
13
trace_dir_name = "main-ns2-mob.ref"
(-)a/regression/tests/test-realtime-udp-echo.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "realtime-udp-echo")
(-)a/regression/tests/test-second.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "second")
(-)a/regression/tests/test-simple-error-model.py (-9 lines)
 Lines 2-13    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate,
13
        "simple-error-model")
(-)a/regression/tests/test-simple-global-routing.py (-9 lines)
 Lines 2-13    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate,
13
        "simple-global-routing")
(-)a/regression/tests/test-simple-point-to-point-olsr.py (-9 lines)
 Lines 2-13    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate,
13
        "simple-point-to-point-olsr")
(-)a/regression/tests/test-static-routing-slash32.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "static-routing-slash32")
(-)a/regression/tests/test-tcp-large-transfer.py (-9 lines)
 Lines 2-13    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate,
13
        "tcp-large-transfer")
(-)a/regression/tests/test-tcp-nsc-lfn.py (-23 / +16 lines)
 Lines 2-33    Link Here 
2
2
3
"""Trace-comparison-type regression test for the Network Simulation Cradle."""
3
"""Trace-comparison-type regression test for the Network Simulation Cradle."""
4
4
5
import os
6
import shutil
7
import sys
8
import tracediff
9
import platform
5
import platform
10
6
11
7
12
def run(verbose, generate):
8
def may_run(env):
13
    """Run a Network Simulation Cradle test involving two TCP streams."""
9
    if not env['NSCxxxxxx_ENABLED']:
10
        return "NSC not available"
11
    else:
12
        return 0
14
13
15
    if not tracediff.env['ENABLE_NSC']:
16
        print >>sys.stderr, "Skipping tcp-nsc-lfn: NSC not available."
17
        raise NotImplementedError
18
14
19
    testName = "tcp-nsc-lfn"
15
platform_bits = platform.architecture()[0]
20
    arguments = ["--ns3::OnOffApplication::DataRate=40000", "--runtime=20"]
16
if platform_bits == "64bit":
21
    platform_bits = platform.architecture()[0]
17
    trace_dir_name = "tcp-nsc-lfn_64bit.ref"
22
    
18
elif platform_bits == "32bit":
23
    if platform_bits == "64bit":
19
    trace_dir_name = "tcp-nsc-lfn_32bit.ref"
24
        traceDirName = testName + "_64bit.ref"
20
else:
25
    elif platform_bits == "32bit":
21
    raise AssertionError("Unknown architecture, not 64 or 32 bit?")
26
        traceDirName = testName + "_32bit.ref"
22
del platform_bits
27
    else:
28
        # Something unexpected. How should we signal an error here? Rasing a
29
        # string might not be the best idea?
30
        raise "Unknown architecture, not 64 or 32 bit?"
31
23
32
    return tracediff.run_test(verbose, generate,
24
arguments = ["--ns3::OnOffApplication::DataRate=40000", "--runtime=20"]
33
        testName, arguments=arguments, refTestName=traceDirName)
25
26
(-)a/regression/tests/test-third.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "third")
(-)a/regression/tests/test-udp-echo.py (-8 lines)
 Lines 2-12    Link Here 
2
2
3
"""Generic trace-comparison-type regression test."""
3
"""Generic trace-comparison-type regression test."""
4
4
5
import os
6
import shutil
7
import tracediff
8
9
def run(verbose, generate):
10
    """Execute a test."""
11
    #print tracediff.env
12
    return tracediff.run_test(verbose, generate, "udp-echo")
(-)a/regression/tests/test-wifi-wired-bridging.py (-7 / +1 lines)
 Lines 2-12    Link Here 
2
2
3
"""Compare that Wifi-Wired Bridging generates correct traces."""
3
"""Compare that Wifi-Wired Bridging generates correct traces."""
4
4
5
import os
5
arguments = ["--SendIp=0"]
6
import shutil
7
import tracediff
8
6
9
def run(verbose, generate):
10
    """Execute a test."""
11
12
    return tracediff.run_test(verbose, generate, "wifi-wired-bridging", ["--SendIp=0"])
(-)a/wscript (-12 / +9 lines)
 Lines 415-420    Link Here 
415
        if not Options.options.compile_targets:
415
        if not Options.options.compile_targets:
416
            Options.options.compile_targets = os.path.basename(program_name)
416
            Options.options.compile_targets = os.path.basename(program_name)
417
417
418
    if Options.options.regression or Options.options.regression_generate:
419
        if not env['DIFF']:
420
            raise Utils.WafError("Cannot run regression tests: the 'diff' program is not installed.")
421
422
        regression_traces = env['REGRESSION_TRACES']
423
        if not regression_traces:
424
            raise Utils.WafError("Cannot run regression tests: reference traces directory not given"
425
                                 " (--with-regression-traces configure option)")
426
        regression.run_regression(bld, regression_traces)
418
427
419
428
420
def get_command_template(*arguments):
429
def get_command_template(*arguments):
 Lines 434-451    Link Here 
434
443
435
    if Options.commands['check']:
444
    if Options.commands['check']:
436
        _run_waf_check()
445
        _run_waf_check()
437
438
    if Options.options.regression or Options.options.regression_generate:
439
        if not env['DIFF']:
440
            raise Utils.WafError("Cannot run regression tests: the 'diff' program is not installed.")
441
442
        regression_traces = env['REGRESSION_TRACES']
443
        if not regression_traces:
444
            raise Utils.WafError("Cannot run regression tests: reference traces directory not given"
445
                                 " (--with-regression-traces configure option)")
446
        retval = regression.run_regression(regression_traces)
447
        if retval:
448
            sys.exit(retval)
449
446
450
    if Options.options.lcov_report:
447
    if Options.options.lcov_report:
451
        lcov_report()
448
        lcov_report()

Return to bug 480