diff options
author | Peter Andersson <[email protected]> | 2010-06-02 13:18:45 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2010-06-09 16:19:20 +0200 |
commit | 24f7909acb5d395756ce1912ab426090e369eb84 (patch) | |
tree | b7a5cf5a1a127a7b34e9cfb66bce784feb25fb20 | |
parent | 7b48e13f301bcfe25ac55d6bc3cf612707673b16 (diff) | |
download | otp-24f7909acb5d395756ce1912ab426090e369eb84.tar.gz otp-24f7909acb5d395756ce1912ab426090e369eb84.tar.bz2 otp-24f7909acb5d395756ce1912ab426090e369eb84.zip |
Add -erl_args flag to run_test program
With -erl_args it's possible to divide the start options on the command line and this way specify explicitly which options are meant for Common Test, and which are meant for other OTP applications (or ERTS).
-rw-r--r-- | erts/etc/common/run_test.c | 88 |
1 files changed, 53 insertions, 35 deletions
diff --git a/erts/etc/common/run_test.c b/erts/etc/common/run_test.c index 027d10acf8..d585d79230 100644 --- a/erts/etc/common/run_test.c +++ b/erts/etc/common/run_test.c @@ -128,6 +128,7 @@ main(int argc, char** argv) int ct_mode; int dist_mode; int cnt; + int erl_args; char** argv0 = argv; emulator = get_default_emulator(argv[0]); @@ -151,42 +152,50 @@ main(int argc, char** argv) dist_mode = SHORT_NAME; browser[0] = '\0'; ct_mode = NORMAL_MODE; - cnt = argc; + erl_args = argc; + cnt = 1; /* * Check various flags before building command line */ - while (cnt > 1) { - if (strcmp(argv[1], "-vts") == 0) { - ct_mode = VTS_MODE; - } - else if (strcmp(argv[1], "-browser") == 0) { - strcpy(browser, argv[2]); - cnt--, argv++; - } - else if (strcmp(argv[1], "-shell") == 0) { - ct_mode = CT_SHELL_MODE; - } - else if (strcmp(argv[1], "-ctmaster") == 0) { - strcpy(nodename, "ct_master"); - ct_mode = MASTER_MODE; - } - else if (strcmp(argv[1], "-ctname") == 0) { - strcpy(nodename, argv[2]); - ct_mode = ERL_SHELL_MODE; - cnt--, argv++; + while (cnt < argc) { + if (strcmp(argv[1], "-erl_args") == 0) { + erl_args = cnt; } else if (strcmp(argv[1], "-sname") == 0) { strcpy(nodename, argv[2]); - cnt--, argv++; + cnt++, argv++; } else if (strcmp(argv[1], "-name") == 0) { strcpy(nodename, argv[2]); dist_mode = FULL_NAME; - cnt--, argv++; + cnt++, argv++; + } + else { + if (cnt < erl_args) { + if (strcmp(argv[1], "-vts") == 0) { + ct_mode = VTS_MODE; + } + else if (strcmp(argv[1], "-browser") == 0) { + strcpy(browser, argv[2]); + cnt++, argv++; + } + else if (strcmp(argv[1], "-shell") == 0) { + ct_mode = CT_SHELL_MODE; + } + else if (strcmp(argv[1], "-ctmaster") == 0) { + strcpy(nodename, "ct_master"); + ct_mode = MASTER_MODE; + } + else if (strcmp(argv[1], "-ctname") == 0) { + strcpy(nodename, argv[2]); + ct_mode = ERL_SHELL_MODE; + cnt++, argv++; + } + } } - cnt--, argv++; + cnt++, argv++; } argv = argv0; @@ -219,19 +228,28 @@ main(int argc, char** argv) PUSH3("-s", "erlang", "halt"); } - while (argc > 1) { - if (strcmp(argv[1], "-config") == 0) - PUSH("-ct_config"); - else if (strcmp(argv[1], "-decrypt_key") == 0) - PUSH("-ct_decrypt_key"); - else if (strcmp(argv[1], "-decrypt_file") == 0) - PUSH("-ct_decrypt_file"); - else if ((strcmp(argv[1], "-sname") == 0) || (strcmp(argv[1], "-name") == 0)) - argc--, argv++; - else + cnt = 1; + while (cnt < argc) { + if (strcmp(argv[1], "-erl_args") == 0) { + PUSH("-ct_erl_args"); + } + else if ((strcmp(argv[1], "-sname") == 0) || (strcmp(argv[1], "-name") == 0)) { + cnt++, argv++; + } + else if (cnt < erl_args) { + if (strcmp(argv[1], "-config") == 0) + PUSH("-ct_config"); + else if (strcmp(argv[1], "-decrypt_key") == 0) + PUSH("-ct_decrypt_key"); + else if (strcmp(argv[1], "-decrypt_file") == 0) + PUSH("-ct_decrypt_file"); + else + PUSH(argv[1]); + } + else { PUSH(argv[1]); - - argc--, argv++; + } + cnt++, argv++; } /* |