[cctest] adding --help option to output basic information about cctest
authorcbruni <cbruni@chromium.org>
Tue, 29 Sep 2015 08:41:26 +0000 (01:41 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 29 Sep 2015 08:41:43 +0000 (08:41 +0000)
[run-tests.py]
- adding more detailed information about the flags
- show more detailed error message on failing Popen commands

BUG=

Review URL: https://codereview.chromium.org/1369343002

Cr-Commit-Position: refs/heads/master@{#30997}

test/cctest/cctest.cc
tools/run-tests.py
tools/testrunner/local/commands.py

index 72be29c..05f276d 100644 (file)
@@ -173,6 +173,20 @@ int main(int argc, char* argv[]) {
 #endif  // V8_CC_MSVC
 #endif  // V8_OS_WIN
 
+  // hack to print cctest specific flags
+  for (int i = 1; i < argc; i++) {
+    char* arg = argv[i];
+    if ((strcmp(arg, "--help") == 0) || (strcmp(arg, "-h") == 0)) {
+      printf("Usage: %s [--list] [[V8_FLAGS] CCTEST]\n", argv[0]);
+      printf("\n");
+      printf("Options:\n");
+      printf("  --list:   list all cctests\n");
+      printf("  CCTEST:   cctest identfier returned by --list\n");
+      printf("  D8_FLAGS: see d8 output below\n");
+      printf("\n\n");
+    }
+  }
+
   v8::V8::InitializeICU();
   v8::Platform* platform = v8::platform::CreateDefaultPlatform();
   v8::V8::InitializePlatform(platform);
index fb0c655..c54c32d 100755 (executable)
@@ -171,9 +171,11 @@ SLOW_ARCHS = ["android_arm",
 
 def BuildOptions():
   result = optparse.OptionParser()
+  result.usage = '%prog [options] [tests]'
+  result.description = """TESTS: %s""" % (DEFAULT_TESTS)
   result.add_option("--arch",
                     help=("The architecture to run tests for, "
-                          "'auto' or 'native' for auto-detect"),
+                          "'auto' or 'native' for auto-detect: %s" % SUPPORTED_ARCHS),
                     default="ia32,x64,arm")
   result.add_option("--arch-and-mode",
                     help="Architecture and mode in the format 'arch.mode'",
@@ -220,7 +222,8 @@ def BuildOptions():
   result.add_option("-j", help="The number of parallel tasks to run",
                     default=0, type="int")
   result.add_option("-m", "--mode",
-                    help="The test modes in which to run (comma-separated)",
+                    help="The test modes in which to run (comma-separated,"
+                    " uppercase for ninja and buildbot builds): %s" % MODES.keys(),
                     default="release,debug")
   result.add_option("--no-harness", "--noharness",
                     help="Run without test harness of a given suite",
@@ -248,7 +251,7 @@ def BuildOptions():
                     help="Don't run any testing variants",
                     default=False, dest="no_variants", action="store_true")
   result.add_option("--variants",
-                    help="Comma-separated list of testing variants")
+                    help="Comma-separated list of testing variants: %s" % VARIANTS)
   result.add_option("--outdir", help="Base directory with compile output",
                     default="out")
   result.add_option("--predictable",
@@ -548,6 +551,8 @@ def Execute(arch, mode, args, options, suites, workspace):
           "%s.%s" % (arch, MODES[mode]["output_folder"]),
       )
   shell_dir = os.path.relpath(shell_dir)
+  if not os.path.exists(shell_dir):
+      raise Exception('Could not find shell_dir: "%s"' % shell_dir)
 
   # Populate context object.
   mode_flags = MODES[mode]["flags"]
index 6aac3ff..a4df32c 100644 (file)
@@ -61,12 +61,18 @@ def RunProcess(verbose, timeout, args, **rest):
     error_mode = SEM_NOGPFAULTERRORBOX
     prev_error_mode = Win32SetErrorMode(error_mode)
     Win32SetErrorMode(error_mode | prev_error_mode)
-  process = subprocess.Popen(
-    args=popen_args,
-    stdout=subprocess.PIPE,
-    stderr=subprocess.PIPE,
-    **rest
-  )
+
+  try:
+    process = subprocess.Popen(
+      args=popen_args,
+      stdout=subprocess.PIPE,
+      stderr=subprocess.PIPE,
+      **rest
+    )
+  except Exception as e:
+    sys.stderr.write("Error executing: %s\n" % popen_args)
+    raise e
+
   if (utils.IsWindows() and prev_error_mode != SEM_INVALID_VALUE):
     Win32SetErrorMode(prev_error_mode)