From 4f00b8a2ae7148b3a13fd6af0e79eb9b6abf5634 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 25 May 2015 09:06:09 +0000 Subject: Fix ingen_test command line arguments. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5686 a436a847-0d15-0410-975c-d299462d15a1 --- tests/ingen_test.cpp | 24 ++++++++++++++---------- wscript | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index 4594bee1..39de3d33 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -132,16 +132,6 @@ main(int argc, char** argv) Glib::thread_init(); set_bundle_path_from_code((void*)&main); - if (argc != 3) { - cerr << "Usage: ingen_test START_GRAPH COMMANDS_FILE" << endl; - return EXIT_FAILURE; - } - - char* real_start_graph = realpath(argv[1], NULL); - const std::string start_graph = real_start_graph; - const std::string cmds_file_path = argv[2]; - free(real_start_graph); - // Create world try { world = new World(argc, argv, NULL, NULL, NULL); @@ -150,6 +140,20 @@ main(int argc, char** argv) return EXIT_FAILURE; } + // Get mandatory command line arguments + const Atom& load = world->conf().option("load"); + const Atom& execute = world->conf().option("execute"); + if (!load.is_valid() || !execute.is_valid()) { + cerr << "Usage: ingen_test --load START_GRAPH --execute COMMANDS_FILE" << endl; + return EXIT_FAILURE; + } + + // Get start graph and commands file options + char* real_start_graph = realpath((const char*)load.get_body(), NULL); + const std::string start_graph = real_start_graph; + const std::string cmds_file_path = (const char*)execute.get_body(); + free(real_start_graph); + // Load modules ingen_try(world->load_module("server_profiled"), "Unable to load server module"); diff --git a/wscript b/wscript index 0e85c8ef..92f6b705 100644 --- a/wscript +++ b/wscript @@ -275,7 +275,7 @@ def test(ctx): autowaf.pre_test(ctx, APPNAME, dirs=['.', 'src', 'tests']) for i in ctx.path.ant_glob('tests/*.ttl'): autowaf.run_tests(ctx, APPNAME, - ['ingen_test ../tests/empty.ingen %s' % i.abspath()], + ['ingen_test --load ../tests/empty.ingen --execute %s' % i.abspath()], dirs=['.', 'src', 'tests']) autowaf.post_test(ctx, APPNAME, dirs=['.', 'src', 'tests'], remove=['/usr*']) -- cgit v1.2.1