Ejemplo n.º 1
0
def main(argv):
    """
        Prepares test cases and executes
    """
    test_cases = [
        '',
        '-h',
        '--help',
        '-b build/',
        '--buildpath=build/',
        '-c performance',
        '--constrain=performance',
        '-d',
        '--duration',
        '-e socket-options-ipv6',
        '--example=socket-options-ipv6',
        '-u',
        '--update-data',
        '-f EXTENSIVE --fullness=EXTENSIVE'
        '-g',
        '--grind',
        '-l',
        '--list',
        '-m',
        '--multiple',
        '-n',
        '--nowaf',
        '-p first',
        '--pyexample=first',
        '-r',
        '--retain',
        '-s ns3-tcp-interoperability',
        '--suite=ns3-tcp-interoperability',
        '-t t_opt.txt',
        '--text=t_opt.txt && rm -rf t_opt.txt',
        '-v',
        '--verbose',
        '-w t_opt.html && rm -rf t_opt.html',
        '--web=t_opt.html && rm -rf t_opt.html',
        '--html=t_opt.html && rm -rf t_opt.html',
        '-x t_opt.xml && rm -rf t_opt.xml',
        '--xml=t_opt.xml && rm -rf t_opt.xml',
    ]

    configure_string = sys.executable + ' waf configure --enable-tests --enable-examples'
    clean_string = sys.executable + ' waf clean'
    cmd_execute_list = [
        '%s && %s test.py %s && %s' %
        (configure_string, sys.executable, option, clean_string)
        for option in test_cases
    ]
    runner = TestBaseClass(argv[1:],
                           "Test suite for the ns-3 unit test runner",
                           'test-py')
    return runner.runtests(cmd_execute_list)
Ejemplo n.º 2
0
def main(argv):
    """
        Prepares test cases and executes
    """
    test_cases = [
      '',
      '-h',
      '--help',
      '-b build/',
      '--buildpath=build/',
      '-c performance',
      '--constrain=performance',
      '-d',
      '--duration',
      '-e socket-options-ipv6',
      '--example=socket-options-ipv6',
      '-u',
      '--update-data',
      '-f EXTENSIVE --fullness=EXTENSIVE'
      '-g',
      '--grind',
      '-l',
      '--list',
      '-m',
      '--multiple',
      '-n',
      '--nowaf',
      '-p first',
      '--pyexample=first',
      '-r',
      '--retain',
      '-s ns3-tcp-interoperability',
      '--suite=ns3-tcp-interoperability',
      '-t t_opt.txt',
      '--text=t_opt.txt && rm -rf t_opt.txt',
      '-v',
      '--verbose',
      '-w t_opt.html && rm -rf t_opt.html',
      '--web=t_opt.html && rm -rf t_opt.html',
      '--html=t_opt.html && rm -rf t_opt.html',
      '-x t_opt.xml && rm -rf t_opt.xml',
      '--xml=t_opt.xml && rm -rf t_opt.xml',
    ]

    configure_string = sys.executable + ' waf configure --enable-tests --enable-examples'
    clean_string = sys.executable + ' waf clean'
    cmd_execute_list = [ '%s && %s test.py %s && %s' % (configure_string, sys.executable, option, clean_string) for option in test_cases]
    runner = TestBaseClass(argv[1:], "Test suite for the ns-3 unit test runner" , 'test-py')
    return runner.runtests(cmd_execute_list)
Ejemplo n.º 3
0
def main(argv):
    """
        Prepares test cases and executes
    """
    runner = TestBaseClass(argv[1:],
                           "Test suite for the ns-3 Waf build system", 'waf')
    in_cmds = runner.override_cmds()
    if in_cmds:
        cmds = in_cmds.split(',')
    else:
        cmds = ['basic', 'build', 'configure', 'step', 'clean', 'dist', 'list']

    config_test_cases = [
        "--enable-gcov",
        "--enable-sudo",
        "--enable-sudo",
        "--enable-tests",
        "--disable-tests",
        "--enable-examples",
        "--disable-examples",
        "--doxygen-no-build",
        "--enable-static",
        "--enable-mpi",
        "--enable-rpath",
        "--enable-modules=build/utils/test-runner.cc.1.o",
        "--boost-static",
        "--boost-mt",
        "--boost-linkage_autodetect",
        "--boost-python=33",
        "--disable-gtk",
        "--int64x64=cairo",
        "--disable-pthread",
        "--force-planetlab",
        "--nopyc",
        "--nopyo",
        "--disable-python",
        "--apiscan=all",
        "--with-python=/usr/bin/env python.7",
        "--no32bit-scan",
        "-o test_out && rm -rf test_out",
        "--out=test_out && rm -rf test_out",
        "-t test_top && rm -rf test_top",
        "--top=test_top && rm -rf test_top",
        "--download",
        "--check-c-compiler=gc",
        "--check-cxx-compiler=g++",
    ]

    basic_test_cases = [
        "--version",
        "-h",
        "--help",
    ]

    build_test_cases = [
        "-j10",
        "--jobs=10",
        "-d optimized",
        "-d debug",
        "-d release",
        "--build-profile optimized",
        "--build-profile debug",
        "--build-profile release",
        "-p",
        "--progress",
    ]

    step_test_cases = [
        "--files=\"*/main.c,*/test/main.o\"",
    ]

    install_test_cases = [
        "-f",
        "--force",
        "--prefix=./test-prefix && rm -rf ./test-prefix",
        "--exec-prefix=.",
        "--bindir=./test-prefix/bin --sbindir=./test-prefix/sbin --libexecdir=./test-prefix/libexec --sysconfdir=./test-prefix/etc --sharedstatedir=./test-prefix/com --localstatedir=./test-prefix/var --libdir=./test-prefix/lib --includedir=./test-prefix/include --oldincludedir=./test-prefix/usr/include --datarootdir=./test-prefix/share --datadir=./test-prefix/share_root --infodir=./test-prefix/info --localedir=./test-prefix/locale --mandir=./test-prefix/man --docdir=./test-prefix/doc/package --htmldir=./test-prefix/doc --dvidir=./test-prefix/doc --pdfdir=./test-prefix/doc --psdir=./test-prefix/doc && rm -rf ./test-prefix",
    ]

    common_test_cases = [
        "",
        "-k",
        "--keep",
        "-v",
        "--verbose",
        "--nocache",
        "--zones=task_gen",
        "--zones=deps",
        "--zones=tasks",
        "--no-task-lines",
    ]

    test_case_mappings = {
        'basic': basic_test_cases,
        'configure': config_test_cases,
        'build': build_test_cases,
        'step': step_test_cases,
        'install': install_test_cases,
    }

    waf_string = sys.executable + ' waf'
    cmd_execute_list = []
    for cmd in cmds:
        if cmd == 'basic':
            cmd_list = []
        else:
            cmd_list = [
                '%s %s %s' % (waf_string, cmd, option)
                for option in common_test_cases
            ]
        if cmd in test_case_mappings:
            cmd_list += [
                '%s %s %s' % (waf_string, cmd, option)
                for option in test_case_mappings[cmd]
            ]
        if cmd == 'basic':
            cmd_list.append(
                '%s configure && %s build && %s --run scratch/myfirst' %
                tuple([waf_string] * 3))
            cmd_list.append(
                '%s configure && %s build && %s --pyrun scratch/myfirst.py' %
                tuple([waf_string] * 3))
        if cmd == 'build':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' clean', cmd_list)
            cmd_list.append(
                '%s configure --enable-gcov && %s build --lcov-report && %s clean'
                % tuple([waf_string] * 3))
        elif cmd == 'configure':
            cmd_list = replace(None, waf_string + ' distclean', cmd_list)
        elif cmd == 'distcheck':
            cmd_list = replace(waf_string + ' dist', 'rm -rf ns-3*.tar.bz2',
                               cmd_list)
        elif cmd == 'docs':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' distclean', cmd_list)
        elif cmd == 'install':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' uninstall', cmd_list)
        elif cmd == 'list':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' distclean', cmd_list)
        elif cmd == 'shell':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' distclean', cmd_list)
        elif cmd == 'step':
            cmd_list = replace(waf_string + ' configure',
                               waf_string + ' distclean', cmd_list)
        elif cmd == 'uninstall':
            cmd_list = replace(waf_string + ' install', None, cmd_list)
        cmd_execute_list += cmd_list

    return runner.runtests(cmd_execute_list)
Ejemplo n.º 4
0
def main(argv):
    """
        Prepares test cases and executes
    """
    runner = TestBaseClass(argv[1:], "Test suite for the ns-3 Waf build system", 'waf')
    in_cmds = runner.override_cmds()
    if in_cmds:
        cmds = in_cmds.split(',')
    else:
        cmds = ['basic', 'build', 'configure', 'step', 'clean', 'dist', 'list']

    config_test_cases = [
        "--enable-gcov",
        "--enable-sudo",
        "--enable-sudo",
        "--enable-tests",
        "--disable-tests",
        "--enable-examples",
        "--disable-examples",
        "--doxygen-no-build",
        "--enable-static",
        "--enable-mpi",
        "--enable-rpath",
        "--enable-modules=build/utils/test-runner.cc.1.o",
        "--boost-static",
        "--boost-mt",
        "--boost-linkage_autodetect",
        "--boost-python=33",
        "--disable-gtk",
        "--int64x64=cairo",
        "--disable-pthread",
        "--force-planetlab",
        "--nopyc",
        "--nopyo",
        "--disable-python",
        "--apiscan=all",
        "--with-python=/usr/bin/python2.7",
        "-o test_out && rm -rf test_out",
        "--out=test_out && rm -rf test_out",
        "-t test_top && rm -rf test_top",
        "--top=test_top && rm -rf test_top",
        "--download",    
        "--check-c-compiler=gc",
        "--check-cxx-compiler=g++",       
    ]

    basic_test_cases = [
        "--version",
        "-h",
        "--help",
    ]

    build_test_cases = [
        "-j10",
        "--jobs=10",
        "-d optimized",
        "-d debug",
        "-d release",
        "--build-profile optimized",
        "--build-profile debug",
        "--build-profile release",
        "-p",
        "--progress",
    ]

    step_test_cases = [
        "--files=\"*/main.c,*/test/main.o\"",
    ]

    install_test_cases = [
        "-f",
        "--force",
        "--prefix=./test-prefix && rm -rf ./test-prefix",
        "--exec-prefix=.",
        "--bindir=./test-prefix/bin --sbindir=./test-prefix/sbin --libexecdir=./test-prefix/libexec --sysconfdir=./test-prefix/etc --sharedstatedir=./test-prefix/com --localstatedir=./test-prefix/var --libdir=./test-prefix/lib --includedir=./test-prefix/include --oldincludedir=./test-prefix/usr/include --datarootdir=./test-prefix/share --datadir=./test-prefix/share_root --infodir=./test-prefix/info --localedir=./test-prefix/locale --mandir=./test-prefix/man --docdir=./test-prefix/doc/package --htmldir=./test-prefix/doc --dvidir=./test-prefix/doc --pdfdir=./test-prefix/doc --psdir=./test-prefix/doc && rm -rf ./test-prefix",
    ]

    common_test_cases = [
        "",
        "-k",
        "--keep",
        "-v",
        "--verbose",
        "--nocache",
        "--zones=task_gen",
        "--zones=deps",
        "--zones=tasks",
        "--no-task-lines",
    ]

    test_case_mappings = {
        'basic' : basic_test_cases,
        'configure' : config_test_cases,
        'build' : build_test_cases,
        'step' : step_test_cases,
        'install' : install_test_cases,
    }

    waf_string = sys.executable + ' waf'
    cmd_execute_list = []
    for cmd in cmds:
        if cmd == 'basic':
            cmd_list = []
        else:
            cmd_list = ['%s %s %s' % (waf_string, cmd, option) for option in common_test_cases ]
        if cmd in test_case_mappings:
            cmd_list += ['%s %s %s' % (waf_string, cmd, option)  for option in test_case_mappings[cmd] ]
        if cmd == 'basic':
            cmd_list.append('%s configure && %s build && %s --run scratch/myfirst' % tuple([waf_string]*3))
            cmd_list.append('%s configure && %s build && %s --pyrun scratch/myfirst.py' % tuple([waf_string]*3))
        if cmd == 'build':
            cmd_list = replace(waf_string+' configure', waf_string+' clean', cmd_list)
            cmd_list.append('%s configure --enable-gcov && %s build --lcov-report && %s clean' % tuple([waf_string]*3))
        elif cmd == 'configure':
            cmd_list = replace(None, waf_string+' distclean', cmd_list)
        elif cmd == 'distcheck':
            cmd_list = replace(waf_string+' dist', 'rm -rf ns-3*.tar.bz2', cmd_list)
        elif cmd == 'docs':
            cmd_list = replace(waf_string+' configure', waf_string+' distclean', cmd_list)
        elif cmd == 'install':
            cmd_list = replace(waf_string+' configure', waf_string+' uninstall', cmd_list)
        elif cmd == 'list':
            cmd_list = replace(waf_string+' configure', waf_string +' distclean', cmd_list)
        elif cmd == 'shell':
            cmd_list = replace(waf_string+' configure', waf_string+' distclean', cmd_list)
        elif cmd == 'step':
            cmd_list = replace(waf_string+' configure', waf_string+' distclean', cmd_list)
        elif cmd == 'uninstall':
            cmd_list = replace(waf_string+' install', None, cmd_list)
        cmd_execute_list += cmd_list

    return runner.runtests(cmd_execute_list)