Beispiel #1
0
def shutdown(ctx):
    bld = wutils.bld
    if wutils.bld is None:
        return
    env = bld.env

    # Only print the lists if a build was done.
    if (env['PRINT_BUILT_MODULES_AT_END']):

        # Print the list of built modules.
        print
        print 'Modules built:'
        names_without_prefix = []
        for name in env['NS3_ENABLED_MODULES']:
            name1 = name[len('ns3-'):]
            if name not in env.MODULAR_BINDINGS_MODULES:
                name1 += " (no Python)"
            names_without_prefix.append(name1)
        print_module_names(names_without_prefix)
        print

        # Print the list of enabled modules that were not built.
        if env['MODULES_NOT_BUILT']:
            print 'Modules not built (see ns-3 tutorial for explanation):'
            print_module_names(env['MODULES_NOT_BUILT'])
            print

        # Set this so that the lists won't be printed until the next
        # build is done.
        bld.env['PRINT_BUILT_MODULES_AT_END'] = False

    # Write the build status file.
    build_status_file = os.path.join(bld.out_dir, 'build-status.py')
    out = open(build_status_file, 'w')
    out.write('#! /usr/bin/env python\n')
    out.write('\n')
    out.write('# Programs that are runnable.\n')
    out.write('ns3_runnable_programs = ' + str(env['NS3_RUNNABLE_PROGRAMS']) + '\n')
    out.write('\n')
    out.write('# Scripts that are runnable.\n')
    out.write('ns3_runnable_scripts = ' + str(env['NS3_RUNNABLE_SCRIPTS']) + '\n')
    out.write('\n')
    out.close()

    if Options.options.lcov_report:
        lcov_report(bld)

    if Options.options.run:
        wutils.run_program(Options.options.run, env, wutils.get_command_template(env),
                           visualize=Options.options.visualize)
        raise SystemExit(0)

    if Options.options.pyrun:
        wutils.run_python_program(Options.options.pyrun, env,
                                  visualize=Options.options.visualize)
        raise SystemExit(0)

    if Options.options.shell:
        raise WafError("Please run `./waf shell' now, instead of `./waf --shell'")

    if Options.options.check:
        raise WafError("Please run `./test.py' now, instead of `./waf --check'")

    check_shell(bld)
        if not os.path.exists(reference_traces_path):
            print "Cannot locate reference traces in " + reference_traces_path
            return 1

        if is_pyscript:
            script = os.path.abspath(os.path.join('..', *os.path.split(program)))
            argv = [self.env['PYTHON'], script] + arguments
            try:
                wutils.run_argv(argv, self.env, cwd=trace_output_path, force_no_valgrind=True)
            except Utils.WafError, ex:
                print >> sys.stderr, ex
                return 1
        else:
            try:
                wutils.run_program(program, self.env,
                                   command_template=wutils.get_command_template(self.env, arguments),
                                   cwd=trace_output_path)
            except Utils.WafError, ex:
                print >> sys.stderr, ex
                return 1

        rc = diff(trace_output_path, reference_traces_path, Options.options.verbose)
        if rc:
            print "----------"
            print "Traces differ in test: ", self.test_name
            print "Reference traces in directory: " + reference_traces_path
            print "Traces in directory: " + trace_output_path
            print "Run the following command for details:"
            print "\tdiff -u %s %s" % (reference_traces_path, trace_output_path)
            if not Options.options.verbose:
                print "Or re-run regression testing with option -v"