Index: tools/testrunner/objects/output.py |
diff --git a/tools/bash-completion.sh b/tools/testrunner/objects/output.py |
old mode 100755 |
new mode 100644 |
similarity index 64% |
copy from tools/bash-completion.sh |
copy to tools/testrunner/objects/output.py |
index 9f65c677317536ae284b29f362e6aa5fce4b88fd..87b4c84e1996607599a6e83fec36efceb339dabc |
--- a/tools/bash-completion.sh |
+++ b/tools/testrunner/objects/output.py |
@@ -1,4 +1,3 @@ |
-#!/bin/bash |
# Copyright 2012 the V8 project authors. All rights reserved. |
# Redistribution and use in source and binary forms, with or without |
# modification, are permitted provided that the following conditions are |
@@ -26,30 +25,36 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-# Inspired by and based on: |
-# http://src.chromium.org/viewvc/chrome/trunk/src/tools/bash-completion |
- |
-# Flag completion rule for bash. |
-# To load in your shell, "source path/to/this/file". |
- |
-v8_source=$(readlink -f $(dirname $BASH_SOURCE)/..) |
- |
-_v8_flag() { |
- local cur defines targets |
- cur="${COMP_WORDS[COMP_CWORD]}" |
- defines=$(cat src/flag-definitions.h \ |
- | grep "^DEFINE" \ |
- | grep -v "DEFINE_implication" \ |
- | sed -e 's/_/-/g') |
- targets=$(echo "$defines" \ |
- | sed -ne 's/^DEFINE-[^(]*(\([^,]*\).*/--\1/p'; \ |
- echo "$defines" \ |
- | sed -ne 's/^DEFINE-bool(\([^,]*\).*/--no\1/p'; \ |
- cat src/d8.cc \ |
- | grep "strcmp(argv\[i\]" \ |
- | sed -ne 's/^[^"]*"--\([^"]*\)".*/--\1/p') |
- COMPREPLY=($(compgen -W "$targets" -- "$cur")) |
- return 0 |
-} |
- |
-complete -F _v8_flag -f d8 |
+ |
+import signal |
+ |
+from ..local import utils |
+ |
+class Output(object): |
+ |
+ def __init__(self, exit_code, timed_out, stdout, stderr): |
+ self.exit_code = exit_code |
+ self.timed_out = timed_out |
+ self.stdout = stdout |
+ self.stderr = stderr |
+ |
+ def HasCrashed(self): |
+ if utils.IsWindows(): |
+ return 0x80000000 & self.exit_code and not (0x3FFFFF00 & self.exit_code) |
+ else: |
+ # Timed out tests will have exit_code -signal.SIGTERM. |
+ if self.timed_out: |
+ return False |
+ return (self.exit_code < 0 and |
+ self.exit_code != -signal.SIGABRT) |
+ |
+ def HasTimedOut(self): |
+ return self.timed_out |
+ |
+ def Pack(self): |
+ return [self.exit_code, self.timed_out, self.stdout, self.stderr] |
+ |
+ @staticmethod |
+ def Unpack(packed): |
+ # For the order of the fields, refer to Pack() above. |
+ return Output(packed[0], packed[1], packed[2], packed[3]) |