about summary refs log tree commit diff
path: root/support/support_test_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'support/support_test_main.c')
-rw-r--r--support/support_test_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/support/support_test_main.c b/support/support_test_main.c
index 07e3cdd173..66a754b84f 100644
--- a/support/support_test_main.c
+++ b/support/support_test_main.c
@@ -228,6 +228,18 @@ run_test_function (int argc, char **argv, const struct test_config *config)
   while (wait_for_debugger)
     usleep (1000);
 
+  if (config->run_command_mode)
+    {
+      /* In run-command-mode, the child process executes the command line
+	 arguments as a new program.  */
+      char **argv_ = xmalloc (sizeof (char *) * argc);
+      memcpy (argv_, &argv[1], sizeof (char *) * (argc - 1));
+      argv_[argc - 1] = NULL;
+      execv (argv_[0], argv_);
+      printf ("error: should not return here\n");
+      exit (1);
+    }
+
   if (config->test_function != NULL)
     return config->test_function ();
   else if (config->test_function_argv != NULL)