Ejemplo n.º 1
0
        print "\t<additional> - additional parameters for <binary>"
        sys.exit(0)

    test_platform()
    path_to_scenario = ""
    binary_name = ""
    template_name_list = ""
    config_name_list = ""
    binary_additional_pars = []

    if len(sys.argv) > 4:
        path_to_scenario = sys.argv[1]
        binary_name = sys.argv[2]
        template_name_list = sys.argv[3].split(':')
        config_name_list = sys.argv[4].split(':')
        if len(template_name_list) != len (config_name_list):
                print "ERROR: Number of j2 template files not equal to number of file names to be generated"
                print "i.e. len(<template>) != len(<config name>), see usage"
                sys.exit(0)

    if len(sys.argv) > 5:
        binary_additional_pars = sys.argv[5:]

    # Scan for scenarios
    test = test.Test()
    for arg in [path_to_scenario]:
        objects = find_objects(arg)
        for path in objects:
            test.add(path, play_object, path, binary_name, config_name_list, template_name_list, binary_additional_pars)
    sys.exit(test.run())
Ejemplo n.º 2
0
        sys.exit(0)

    test_platform()
    path_to_scenario = ""
    binary_name = ""
    template_name_list = ""
    config_name_list = ""
    binary_additional_pars = []

    if len(sys.argv) > 4:
        path_to_scenario = sys.argv[1]
        binary_name = sys.argv[2]
        template_name_list = sys.argv[3].split(':')
        config_name_list = sys.argv[4].split(':')
        if len(template_name_list) != len(config_name_list):
            print "ERROR: Number of j2 template files not equal to number of file names to be generated"
            print "i.e. len(<template>) != len(<config name>), see usage"
            sys.exit(0)

    if len(sys.argv) > 5:
        binary_additional_pars = sys.argv[5:]

    # Scan for scenarios
    test = test.Test()
    for arg in [path_to_scenario]:
        objects = find_objects(arg)
        for path in objects:
            test.add(path, play_object, path, binary_name, config_name_list,
                     template_name_list, binary_additional_pars)
    sys.exit(test.run())
        if TEST_DEBUG > 0:
            print('--- server listening at %s ---' % str(server.address()))
            print('--- scenario parsed, any key to continue ---')
            sys.stdin.readline()
        scenario.play(mock_ctx)
    finally:
        server.stop()
        mock_ctx.deinit()


def test_platform(*args):
    if sys.platform == 'windows':
        raise Exception('not supported at all on Windows')


if __name__ == '__main__':

    # Self-tests first
    test = test.Test()
    test.add('integration/platform', test_platform)
    test.add('testserver/sendrecv', testserver.test_sendrecv)
    if test.run() != 0:
        sys.exit(1)
    else:
        # Scan for scenarios
        for arg in sys.argv[1:]:
            objects = find_objects(arg)
            for path in objects:
                test.add(path, play_object, path)
        sys.exit(test.run())