libv8-sgonyea 3.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/README.md +76 -0
- data/Rakefile +113 -0
- data/ext/libv8/extconf.rb +28 -0
- data/lib/libv8.rb +15 -0
- data/lib/libv8/Makefile +30 -0
- data/lib/libv8/detect_cpu.rb +27 -0
- data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
- data/lib/libv8/v8/.gitignore +35 -0
- data/lib/libv8/v8/AUTHORS +44 -0
- data/lib/libv8/v8/ChangeLog +2839 -0
- data/lib/libv8/v8/LICENSE +52 -0
- data/lib/libv8/v8/LICENSE.strongtalk +29 -0
- data/lib/libv8/v8/LICENSE.v8 +26 -0
- data/lib/libv8/v8/LICENSE.valgrind +45 -0
- data/lib/libv8/v8/SConstruct +1478 -0
- data/lib/libv8/v8/build/README.txt +49 -0
- data/lib/libv8/v8/build/all.gyp +18 -0
- data/lib/libv8/v8/build/armu.gypi +32 -0
- data/lib/libv8/v8/build/common.gypi +144 -0
- data/lib/libv8/v8/build/gyp_v8 +145 -0
- data/lib/libv8/v8/include/v8-debug.h +395 -0
- data/lib/libv8/v8/include/v8-preparser.h +117 -0
- data/lib/libv8/v8/include/v8-profiler.h +505 -0
- data/lib/libv8/v8/include/v8-testing.h +104 -0
- data/lib/libv8/v8/include/v8.h +4124 -0
- data/lib/libv8/v8/include/v8stdint.h +53 -0
- data/lib/libv8/v8/preparser/SConscript +38 -0
- data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
- data/lib/libv8/v8/src/SConscript +368 -0
- data/lib/libv8/v8/src/accessors.cc +767 -0
- data/lib/libv8/v8/src/accessors.h +123 -0
- data/lib/libv8/v8/src/allocation-inl.h +49 -0
- data/lib/libv8/v8/src/allocation.cc +122 -0
- data/lib/libv8/v8/src/allocation.h +143 -0
- data/lib/libv8/v8/src/api.cc +5845 -0
- data/lib/libv8/v8/src/api.h +574 -0
- data/lib/libv8/v8/src/apinatives.js +110 -0
- data/lib/libv8/v8/src/apiutils.h +73 -0
- data/lib/libv8/v8/src/arguments.h +118 -0
- data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
- data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
- data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
- data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
- data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
- data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
- data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
- data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
- data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
- data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
- data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
- data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
- data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
- data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
- data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
- data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
- data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
- data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
- data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
- data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
- data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
- data/lib/libv8/v8/src/array.js +1366 -0
- data/lib/libv8/v8/src/assembler.cc +1207 -0
- data/lib/libv8/v8/src/assembler.h +858 -0
- data/lib/libv8/v8/src/ast-inl.h +112 -0
- data/lib/libv8/v8/src/ast.cc +1146 -0
- data/lib/libv8/v8/src/ast.h +2188 -0
- data/lib/libv8/v8/src/atomicops.h +167 -0
- data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
- data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
- data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
- data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
- data/lib/libv8/v8/src/bignum.cc +768 -0
- data/lib/libv8/v8/src/bignum.h +140 -0
- data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
- data/lib/libv8/v8/src/bootstrapper.h +188 -0
- data/lib/libv8/v8/src/builtins.cc +1707 -0
- data/lib/libv8/v8/src/builtins.h +371 -0
- data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
- data/lib/libv8/v8/src/cached-powers.cc +177 -0
- data/lib/libv8/v8/src/cached-powers.h +65 -0
- data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
- data/lib/libv8/v8/src/char-predicates.h +67 -0
- data/lib/libv8/v8/src/checks.cc +110 -0
- data/lib/libv8/v8/src/checks.h +296 -0
- data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
- data/lib/libv8/v8/src/circular-queue.cc +122 -0
- data/lib/libv8/v8/src/circular-queue.h +103 -0
- data/lib/libv8/v8/src/code-stubs.cc +267 -0
- data/lib/libv8/v8/src/code-stubs.h +1011 -0
- data/lib/libv8/v8/src/code.h +70 -0
- data/lib/libv8/v8/src/codegen.cc +231 -0
- data/lib/libv8/v8/src/codegen.h +84 -0
- data/lib/libv8/v8/src/compilation-cache.cc +540 -0
- data/lib/libv8/v8/src/compilation-cache.h +287 -0
- data/lib/libv8/v8/src/compiler.cc +786 -0
- data/lib/libv8/v8/src/compiler.h +312 -0
- data/lib/libv8/v8/src/contexts.cc +347 -0
- data/lib/libv8/v8/src/contexts.h +391 -0
- data/lib/libv8/v8/src/conversions-inl.h +106 -0
- data/lib/libv8/v8/src/conversions.cc +1131 -0
- data/lib/libv8/v8/src/conversions.h +135 -0
- data/lib/libv8/v8/src/counters.cc +93 -0
- data/lib/libv8/v8/src/counters.h +254 -0
- data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
- data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
- data/lib/libv8/v8/src/cpu-profiler.h +302 -0
- data/lib/libv8/v8/src/cpu.h +69 -0
- data/lib/libv8/v8/src/d8-debug.cc +367 -0
- data/lib/libv8/v8/src/d8-debug.h +158 -0
- data/lib/libv8/v8/src/d8-posix.cc +695 -0
- data/lib/libv8/v8/src/d8-readline.cc +130 -0
- data/lib/libv8/v8/src/d8-windows.cc +42 -0
- data/lib/libv8/v8/src/d8.cc +803 -0
- data/lib/libv8/v8/src/d8.gyp +91 -0
- data/lib/libv8/v8/src/d8.h +235 -0
- data/lib/libv8/v8/src/d8.js +2798 -0
- data/lib/libv8/v8/src/data-flow.cc +66 -0
- data/lib/libv8/v8/src/data-flow.h +205 -0
- data/lib/libv8/v8/src/date.js +1103 -0
- data/lib/libv8/v8/src/dateparser-inl.h +127 -0
- data/lib/libv8/v8/src/dateparser.cc +178 -0
- data/lib/libv8/v8/src/dateparser.h +266 -0
- data/lib/libv8/v8/src/debug-agent.cc +447 -0
- data/lib/libv8/v8/src/debug-agent.h +129 -0
- data/lib/libv8/v8/src/debug-debugger.js +2569 -0
- data/lib/libv8/v8/src/debug.cc +3165 -0
- data/lib/libv8/v8/src/debug.h +1057 -0
- data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
- data/lib/libv8/v8/src/deoptimizer.h +602 -0
- data/lib/libv8/v8/src/disasm.h +80 -0
- data/lib/libv8/v8/src/disassembler.cc +343 -0
- data/lib/libv8/v8/src/disassembler.h +58 -0
- data/lib/libv8/v8/src/diy-fp.cc +58 -0
- data/lib/libv8/v8/src/diy-fp.h +117 -0
- data/lib/libv8/v8/src/double.h +238 -0
- data/lib/libv8/v8/src/dtoa.cc +103 -0
- data/lib/libv8/v8/src/dtoa.h +85 -0
- data/lib/libv8/v8/src/execution.cc +849 -0
- data/lib/libv8/v8/src/execution.h +297 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
- data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
- data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
- data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
- data/lib/libv8/v8/src/factory.cc +1222 -0
- data/lib/libv8/v8/src/factory.h +442 -0
- data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
- data/lib/libv8/v8/src/fast-dtoa.h +83 -0
- data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
- data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
- data/lib/libv8/v8/src/flag-definitions.h +560 -0
- data/lib/libv8/v8/src/flags.cc +551 -0
- data/lib/libv8/v8/src/flags.h +79 -0
- data/lib/libv8/v8/src/frames-inl.h +247 -0
- data/lib/libv8/v8/src/frames.cc +1243 -0
- data/lib/libv8/v8/src/frames.h +870 -0
- data/lib/libv8/v8/src/full-codegen.cc +1374 -0
- data/lib/libv8/v8/src/full-codegen.h +771 -0
- data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
- data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
- data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
- data/lib/libv8/v8/src/gdb-jit.h +143 -0
- data/lib/libv8/v8/src/global-handles.cc +665 -0
- data/lib/libv8/v8/src/global-handles.h +284 -0
- data/lib/libv8/v8/src/globals.h +325 -0
- data/lib/libv8/v8/src/handles-inl.h +177 -0
- data/lib/libv8/v8/src/handles.cc +987 -0
- data/lib/libv8/v8/src/handles.h +382 -0
- data/lib/libv8/v8/src/hashmap.cc +230 -0
- data/lib/libv8/v8/src/hashmap.h +123 -0
- data/lib/libv8/v8/src/heap-inl.h +704 -0
- data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
- data/lib/libv8/v8/src/heap-profiler.h +397 -0
- data/lib/libv8/v8/src/heap.cc +5930 -0
- data/lib/libv8/v8/src/heap.h +2268 -0
- data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
- data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
- data/lib/libv8/v8/src/hydrogen.cc +6239 -0
- data/lib/libv8/v8/src/hydrogen.h +1202 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
- data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
- data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
- data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
- data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
- data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
- data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
- data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
- data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
- data/lib/libv8/v8/src/ic-inl.h +130 -0
- data/lib/libv8/v8/src/ic.cc +2577 -0
- data/lib/libv8/v8/src/ic.h +736 -0
- data/lib/libv8/v8/src/inspector.cc +63 -0
- data/lib/libv8/v8/src/inspector.h +62 -0
- data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
- data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
- data/lib/libv8/v8/src/isolate-inl.h +50 -0
- data/lib/libv8/v8/src/isolate.cc +1869 -0
- data/lib/libv8/v8/src/isolate.h +1382 -0
- data/lib/libv8/v8/src/json-parser.cc +504 -0
- data/lib/libv8/v8/src/json-parser.h +161 -0
- data/lib/libv8/v8/src/json.js +342 -0
- data/lib/libv8/v8/src/jsregexp.cc +5385 -0
- data/lib/libv8/v8/src/jsregexp.h +1492 -0
- data/lib/libv8/v8/src/list-inl.h +212 -0
- data/lib/libv8/v8/src/list.h +174 -0
- data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
- data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
- data/lib/libv8/v8/src/lithium-allocator.h +630 -0
- data/lib/libv8/v8/src/lithium.cc +190 -0
- data/lib/libv8/v8/src/lithium.h +597 -0
- data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
- data/lib/libv8/v8/src/liveedit.cc +1691 -0
- data/lib/libv8/v8/src/liveedit.h +180 -0
- data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
- data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
- data/lib/libv8/v8/src/liveobjectlist.h +322 -0
- data/lib/libv8/v8/src/log-inl.h +59 -0
- data/lib/libv8/v8/src/log-utils.cc +428 -0
- data/lib/libv8/v8/src/log-utils.h +231 -0
- data/lib/libv8/v8/src/log.cc +1993 -0
- data/lib/libv8/v8/src/log.h +476 -0
- data/lib/libv8/v8/src/macro-assembler.h +120 -0
- data/lib/libv8/v8/src/macros.py +178 -0
- data/lib/libv8/v8/src/mark-compact.cc +3143 -0
- data/lib/libv8/v8/src/mark-compact.h +506 -0
- data/lib/libv8/v8/src/math.js +264 -0
- data/lib/libv8/v8/src/messages.cc +179 -0
- data/lib/libv8/v8/src/messages.h +113 -0
- data/lib/libv8/v8/src/messages.js +1096 -0
- data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
- data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
- data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
- data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
- data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
- data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
- data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
- data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
- data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
- data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
- data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
- data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
- data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
- data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
- data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
- data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
- data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
- data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
- data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
- data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
- data/lib/libv8/v8/src/mksnapshot.cc +328 -0
- data/lib/libv8/v8/src/natives.h +64 -0
- data/lib/libv8/v8/src/objects-debug.cc +738 -0
- data/lib/libv8/v8/src/objects-inl.h +4323 -0
- data/lib/libv8/v8/src/objects-printer.cc +829 -0
- data/lib/libv8/v8/src/objects-visiting.cc +148 -0
- data/lib/libv8/v8/src/objects-visiting.h +424 -0
- data/lib/libv8/v8/src/objects.cc +10585 -0
- data/lib/libv8/v8/src/objects.h +6838 -0
- data/lib/libv8/v8/src/parser.cc +4997 -0
- data/lib/libv8/v8/src/parser.h +765 -0
- data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
- data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
- data/lib/libv8/v8/src/platform-linux.cc +1149 -0
- data/lib/libv8/v8/src/platform-macos.cc +830 -0
- data/lib/libv8/v8/src/platform-nullos.cc +479 -0
- data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
- data/lib/libv8/v8/src/platform-posix.cc +424 -0
- data/lib/libv8/v8/src/platform-solaris.cc +762 -0
- data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
- data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
- data/lib/libv8/v8/src/platform-tls.h +50 -0
- data/lib/libv8/v8/src/platform-win32.cc +2021 -0
- data/lib/libv8/v8/src/platform.h +667 -0
- data/lib/libv8/v8/src/preparse-data-format.h +62 -0
- data/lib/libv8/v8/src/preparse-data.cc +183 -0
- data/lib/libv8/v8/src/preparse-data.h +225 -0
- data/lib/libv8/v8/src/preparser-api.cc +220 -0
- data/lib/libv8/v8/src/preparser.cc +1450 -0
- data/lib/libv8/v8/src/preparser.h +493 -0
- data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
- data/lib/libv8/v8/src/prettyprinter.h +223 -0
- data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
- data/lib/libv8/v8/src/profile-generator.cc +3098 -0
- data/lib/libv8/v8/src/profile-generator.h +1126 -0
- data/lib/libv8/v8/src/property.cc +105 -0
- data/lib/libv8/v8/src/property.h +365 -0
- data/lib/libv8/v8/src/proxy.js +83 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
- data/lib/libv8/v8/src/regexp-stack.cc +111 -0
- data/lib/libv8/v8/src/regexp-stack.h +147 -0
- data/lib/libv8/v8/src/regexp.js +483 -0
- data/lib/libv8/v8/src/rewriter.cc +360 -0
- data/lib/libv8/v8/src/rewriter.h +50 -0
- data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
- data/lib/libv8/v8/src/runtime-profiler.h +201 -0
- data/lib/libv8/v8/src/runtime.cc +12227 -0
- data/lib/libv8/v8/src/runtime.h +652 -0
- data/lib/libv8/v8/src/runtime.js +649 -0
- data/lib/libv8/v8/src/safepoint-table.cc +256 -0
- data/lib/libv8/v8/src/safepoint-table.h +270 -0
- data/lib/libv8/v8/src/scanner-base.cc +952 -0
- data/lib/libv8/v8/src/scanner-base.h +670 -0
- data/lib/libv8/v8/src/scanner.cc +345 -0
- data/lib/libv8/v8/src/scanner.h +146 -0
- data/lib/libv8/v8/src/scopeinfo.cc +646 -0
- data/lib/libv8/v8/src/scopeinfo.h +254 -0
- data/lib/libv8/v8/src/scopes.cc +1150 -0
- data/lib/libv8/v8/src/scopes.h +507 -0
- data/lib/libv8/v8/src/serialize.cc +1574 -0
- data/lib/libv8/v8/src/serialize.h +589 -0
- data/lib/libv8/v8/src/shell.h +55 -0
- data/lib/libv8/v8/src/simulator.h +43 -0
- data/lib/libv8/v8/src/small-pointer-list.h +163 -0
- data/lib/libv8/v8/src/smart-pointer.h +109 -0
- data/lib/libv8/v8/src/snapshot-common.cc +83 -0
- data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
- data/lib/libv8/v8/src/snapshot.h +91 -0
- data/lib/libv8/v8/src/spaces-inl.h +529 -0
- data/lib/libv8/v8/src/spaces.cc +3145 -0
- data/lib/libv8/v8/src/spaces.h +2369 -0
- data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
- data/lib/libv8/v8/src/splay-tree.h +205 -0
- data/lib/libv8/v8/src/string-search.cc +41 -0
- data/lib/libv8/v8/src/string-search.h +568 -0
- data/lib/libv8/v8/src/string-stream.cc +592 -0
- data/lib/libv8/v8/src/string-stream.h +191 -0
- data/lib/libv8/v8/src/string.js +994 -0
- data/lib/libv8/v8/src/strtod.cc +440 -0
- data/lib/libv8/v8/src/strtod.h +40 -0
- data/lib/libv8/v8/src/stub-cache.cc +1965 -0
- data/lib/libv8/v8/src/stub-cache.h +924 -0
- data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
- data/lib/libv8/v8/src/token.cc +63 -0
- data/lib/libv8/v8/src/token.h +288 -0
- data/lib/libv8/v8/src/type-info.cc +507 -0
- data/lib/libv8/v8/src/type-info.h +272 -0
- data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
- data/lib/libv8/v8/src/unbound-queue.h +69 -0
- data/lib/libv8/v8/src/unicode-inl.h +238 -0
- data/lib/libv8/v8/src/unicode.cc +1624 -0
- data/lib/libv8/v8/src/unicode.h +280 -0
- data/lib/libv8/v8/src/uri.js +408 -0
- data/lib/libv8/v8/src/utils-inl.h +48 -0
- data/lib/libv8/v8/src/utils.cc +371 -0
- data/lib/libv8/v8/src/utils.h +800 -0
- data/lib/libv8/v8/src/v8-counters.cc +62 -0
- data/lib/libv8/v8/src/v8-counters.h +314 -0
- data/lib/libv8/v8/src/v8.cc +213 -0
- data/lib/libv8/v8/src/v8.h +131 -0
- data/lib/libv8/v8/src/v8checks.h +64 -0
- data/lib/libv8/v8/src/v8dll-main.cc +44 -0
- data/lib/libv8/v8/src/v8globals.h +512 -0
- data/lib/libv8/v8/src/v8memory.h +82 -0
- data/lib/libv8/v8/src/v8natives.js +1310 -0
- data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
- data/lib/libv8/v8/src/v8threads.cc +464 -0
- data/lib/libv8/v8/src/v8threads.h +165 -0
- data/lib/libv8/v8/src/v8utils.h +319 -0
- data/lib/libv8/v8/src/variables.cc +114 -0
- data/lib/libv8/v8/src/variables.h +167 -0
- data/lib/libv8/v8/src/version.cc +116 -0
- data/lib/libv8/v8/src/version.h +68 -0
- data/lib/libv8/v8/src/vm-state-inl.h +138 -0
- data/lib/libv8/v8/src/vm-state.h +71 -0
- data/lib/libv8/v8/src/win32-headers.h +96 -0
- data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
- data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
- data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
- data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
- data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
- data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
- data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
- data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
- data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
- data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
- data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
- data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
- data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
- data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
- data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
- data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
- data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
- data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
- data/lib/libv8/v8/src/zone-inl.h +140 -0
- data/lib/libv8/v8/src/zone.cc +196 -0
- data/lib/libv8/v8/src/zone.h +240 -0
- data/lib/libv8/v8/tools/codemap.js +265 -0
- data/lib/libv8/v8/tools/consarray.js +93 -0
- data/lib/libv8/v8/tools/csvparser.js +78 -0
- data/lib/libv8/v8/tools/disasm.py +92 -0
- data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
- data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
- data/lib/libv8/v8/tools/gcmole/README +62 -0
- data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
- data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
- data/lib/libv8/v8/tools/grokdump.py +841 -0
- data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
- data/lib/libv8/v8/tools/js2c.py +364 -0
- data/lib/libv8/v8/tools/jsmin.py +280 -0
- data/lib/libv8/v8/tools/linux-tick-processor +35 -0
- data/lib/libv8/v8/tools/ll_prof.py +942 -0
- data/lib/libv8/v8/tools/logreader.js +185 -0
- data/lib/libv8/v8/tools/mac-nm +18 -0
- data/lib/libv8/v8/tools/mac-tick-processor +6 -0
- data/lib/libv8/v8/tools/oom_dump/README +31 -0
- data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
- data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
- data/lib/libv8/v8/tools/presubmit.py +305 -0
- data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
- data/lib/libv8/v8/tools/profile.js +751 -0
- data/lib/libv8/v8/tools/profile_view.js +219 -0
- data/lib/libv8/v8/tools/run-valgrind.py +77 -0
- data/lib/libv8/v8/tools/splaytree.js +316 -0
- data/lib/libv8/v8/tools/stats-viewer.py +468 -0
- data/lib/libv8/v8/tools/test.py +1510 -0
- data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
- data/lib/libv8/v8/tools/tickprocessor.js +877 -0
- data/lib/libv8/v8/tools/utils.py +96 -0
- data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
- data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
- data/lib/libv8/version.rb +5 -0
- data/libv8.gemspec +36 -0
- metadata +578 -0
@@ -0,0 +1,1510 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
#
|
3
|
+
# Copyright 2008 the V8 project authors. All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are
|
6
|
+
# met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following
|
12
|
+
# disclaimer in the documentation and/or other materials provided
|
13
|
+
# with the distribution.
|
14
|
+
# * Neither the name of Google Inc. nor the names of its
|
15
|
+
# contributors may be used to endorse or promote products derived
|
16
|
+
# from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
20
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
22
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
23
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
|
31
|
+
import imp
|
32
|
+
import optparse
|
33
|
+
import os
|
34
|
+
from os.path import join, dirname, abspath, basename, isdir, exists
|
35
|
+
import platform
|
36
|
+
import re
|
37
|
+
import signal
|
38
|
+
import subprocess
|
39
|
+
import sys
|
40
|
+
import tempfile
|
41
|
+
import time
|
42
|
+
import threading
|
43
|
+
import utils
|
44
|
+
from Queue import Queue, Empty
|
45
|
+
|
46
|
+
|
47
|
+
VERBOSE = False
|
48
|
+
|
49
|
+
|
50
|
+
# ---------------------------------------------
|
51
|
+
# --- P r o g r e s s I n d i c a t o r s ---
|
52
|
+
# ---------------------------------------------
|
53
|
+
|
54
|
+
|
55
|
+
class ProgressIndicator(object):
|
56
|
+
|
57
|
+
def __init__(self, cases):
|
58
|
+
self.cases = cases
|
59
|
+
self.queue = Queue(len(cases))
|
60
|
+
for case in cases:
|
61
|
+
self.queue.put_nowait(case)
|
62
|
+
self.succeeded = 0
|
63
|
+
self.remaining = len(cases)
|
64
|
+
self.total = len(cases)
|
65
|
+
self.failed = [ ]
|
66
|
+
self.crashed = 0
|
67
|
+
self.terminate = False
|
68
|
+
self.lock = threading.Lock()
|
69
|
+
|
70
|
+
def PrintFailureHeader(self, test):
|
71
|
+
if test.IsNegative():
|
72
|
+
negative_marker = '[negative] '
|
73
|
+
else:
|
74
|
+
negative_marker = ''
|
75
|
+
print "=== %(label)s %(negative)s===" % {
|
76
|
+
'label': test.GetLabel(),
|
77
|
+
'negative': negative_marker
|
78
|
+
}
|
79
|
+
print "Path: %s" % "/".join(test.path)
|
80
|
+
|
81
|
+
def Run(self, tasks):
|
82
|
+
self.Starting()
|
83
|
+
threads = []
|
84
|
+
# Spawn N-1 threads and then use this thread as the last one.
|
85
|
+
# That way -j1 avoids threading altogether which is a nice fallback
|
86
|
+
# in case of threading problems.
|
87
|
+
for i in xrange(tasks - 1):
|
88
|
+
thread = threading.Thread(target=self.RunSingle, args=[])
|
89
|
+
threads.append(thread)
|
90
|
+
thread.start()
|
91
|
+
try:
|
92
|
+
self.RunSingle()
|
93
|
+
# Wait for the remaining threads
|
94
|
+
for thread in threads:
|
95
|
+
# Use a timeout so that signals (ctrl-c) will be processed.
|
96
|
+
thread.join(timeout=10000000)
|
97
|
+
except Exception, e:
|
98
|
+
# If there's an exception we schedule an interruption for any
|
99
|
+
# remaining threads.
|
100
|
+
self.terminate = True
|
101
|
+
# ...and then reraise the exception to bail out
|
102
|
+
raise
|
103
|
+
self.Done()
|
104
|
+
return not self.failed
|
105
|
+
|
106
|
+
def RunSingle(self):
|
107
|
+
while not self.terminate:
|
108
|
+
try:
|
109
|
+
test = self.queue.get_nowait()
|
110
|
+
except Empty:
|
111
|
+
return
|
112
|
+
case = test.case
|
113
|
+
self.lock.acquire()
|
114
|
+
self.AboutToRun(case)
|
115
|
+
self.lock.release()
|
116
|
+
try:
|
117
|
+
start = time.time()
|
118
|
+
output = case.Run()
|
119
|
+
case.duration = (time.time() - start)
|
120
|
+
except BreakNowException:
|
121
|
+
self.terminate = True
|
122
|
+
except IOError, e:
|
123
|
+
assert self.terminate
|
124
|
+
return
|
125
|
+
if self.terminate:
|
126
|
+
return
|
127
|
+
self.lock.acquire()
|
128
|
+
if output.UnexpectedOutput():
|
129
|
+
self.failed.append(output)
|
130
|
+
if output.HasCrashed():
|
131
|
+
self.crashed += 1
|
132
|
+
else:
|
133
|
+
self.succeeded += 1
|
134
|
+
self.remaining -= 1
|
135
|
+
self.HasRun(output)
|
136
|
+
self.lock.release()
|
137
|
+
|
138
|
+
|
139
|
+
def EscapeCommand(command):
|
140
|
+
parts = []
|
141
|
+
for part in command:
|
142
|
+
if ' ' in part:
|
143
|
+
# Escape spaces. We may need to escape more characters for this
|
144
|
+
# to work properly.
|
145
|
+
parts.append('"%s"' % part)
|
146
|
+
else:
|
147
|
+
parts.append(part)
|
148
|
+
return " ".join(parts)
|
149
|
+
|
150
|
+
|
151
|
+
class SimpleProgressIndicator(ProgressIndicator):
|
152
|
+
|
153
|
+
def Starting(self):
|
154
|
+
print 'Running %i tests' % len(self.cases)
|
155
|
+
|
156
|
+
def Done(self):
|
157
|
+
print
|
158
|
+
for failed in self.failed:
|
159
|
+
self.PrintFailureHeader(failed.test)
|
160
|
+
if failed.output.stderr:
|
161
|
+
print "--- stderr ---"
|
162
|
+
print failed.output.stderr.strip()
|
163
|
+
if failed.output.stdout:
|
164
|
+
print "--- stdout ---"
|
165
|
+
print failed.output.stdout.strip()
|
166
|
+
print "Command: %s" % EscapeCommand(failed.command)
|
167
|
+
if failed.HasCrashed():
|
168
|
+
print "--- CRASHED ---"
|
169
|
+
if failed.HasTimedOut():
|
170
|
+
print "--- TIMEOUT ---"
|
171
|
+
if len(self.failed) == 0:
|
172
|
+
print "==="
|
173
|
+
print "=== All tests succeeded"
|
174
|
+
print "==="
|
175
|
+
else:
|
176
|
+
print
|
177
|
+
print "==="
|
178
|
+
print "=== %i tests failed" % len(self.failed)
|
179
|
+
if self.crashed > 0:
|
180
|
+
print "=== %i tests CRASHED" % self.crashed
|
181
|
+
print "==="
|
182
|
+
|
183
|
+
|
184
|
+
class VerboseProgressIndicator(SimpleProgressIndicator):
|
185
|
+
|
186
|
+
def AboutToRun(self, case):
|
187
|
+
print 'Starting %s...' % case.GetLabel()
|
188
|
+
sys.stdout.flush()
|
189
|
+
|
190
|
+
def HasRun(self, output):
|
191
|
+
if output.UnexpectedOutput():
|
192
|
+
if output.HasCrashed():
|
193
|
+
outcome = 'CRASH'
|
194
|
+
else:
|
195
|
+
outcome = 'FAIL'
|
196
|
+
else:
|
197
|
+
outcome = 'pass'
|
198
|
+
print 'Done running %s: %s' % (output.test.GetLabel(), outcome)
|
199
|
+
|
200
|
+
|
201
|
+
class DotsProgressIndicator(SimpleProgressIndicator):
|
202
|
+
|
203
|
+
def AboutToRun(self, case):
|
204
|
+
pass
|
205
|
+
|
206
|
+
def HasRun(self, output):
|
207
|
+
total = self.succeeded + len(self.failed)
|
208
|
+
if (total > 1) and (total % 50 == 1):
|
209
|
+
sys.stdout.write('\n')
|
210
|
+
if output.UnexpectedOutput():
|
211
|
+
if output.HasCrashed():
|
212
|
+
sys.stdout.write('C')
|
213
|
+
sys.stdout.flush()
|
214
|
+
elif output.HasTimedOut():
|
215
|
+
sys.stdout.write('T')
|
216
|
+
sys.stdout.flush()
|
217
|
+
else:
|
218
|
+
sys.stdout.write('F')
|
219
|
+
sys.stdout.flush()
|
220
|
+
else:
|
221
|
+
sys.stdout.write('.')
|
222
|
+
sys.stdout.flush()
|
223
|
+
|
224
|
+
|
225
|
+
class CompactProgressIndicator(ProgressIndicator):
|
226
|
+
|
227
|
+
def __init__(self, cases, templates):
|
228
|
+
super(CompactProgressIndicator, self).__init__(cases)
|
229
|
+
self.templates = templates
|
230
|
+
self.last_status_length = 0
|
231
|
+
self.start_time = time.time()
|
232
|
+
|
233
|
+
def Starting(self):
|
234
|
+
pass
|
235
|
+
|
236
|
+
def Done(self):
|
237
|
+
self.PrintProgress('Done')
|
238
|
+
|
239
|
+
def AboutToRun(self, case):
|
240
|
+
self.PrintProgress(case.GetLabel())
|
241
|
+
|
242
|
+
def HasRun(self, output):
|
243
|
+
if output.UnexpectedOutput():
|
244
|
+
self.ClearLine(self.last_status_length)
|
245
|
+
self.PrintFailureHeader(output.test)
|
246
|
+
stdout = output.output.stdout.strip()
|
247
|
+
if len(stdout):
|
248
|
+
print self.templates['stdout'] % stdout
|
249
|
+
stderr = output.output.stderr.strip()
|
250
|
+
if len(stderr):
|
251
|
+
print self.templates['stderr'] % stderr
|
252
|
+
print "Command: %s" % EscapeCommand(output.command)
|
253
|
+
if output.HasCrashed():
|
254
|
+
print "--- CRASHED ---"
|
255
|
+
if output.HasTimedOut():
|
256
|
+
print "--- TIMEOUT ---"
|
257
|
+
|
258
|
+
def Truncate(self, str, length):
|
259
|
+
if length and (len(str) > (length - 3)):
|
260
|
+
return str[:(length-3)] + "..."
|
261
|
+
else:
|
262
|
+
return str
|
263
|
+
|
264
|
+
def PrintProgress(self, name):
|
265
|
+
self.ClearLine(self.last_status_length)
|
266
|
+
elapsed = time.time() - self.start_time
|
267
|
+
status = self.templates['status_line'] % {
|
268
|
+
'passed': self.succeeded,
|
269
|
+
'remaining': (((self.total - self.remaining) * 100) // self.total),
|
270
|
+
'failed': len(self.failed),
|
271
|
+
'test': name,
|
272
|
+
'mins': int(elapsed) / 60,
|
273
|
+
'secs': int(elapsed) % 60
|
274
|
+
}
|
275
|
+
status = self.Truncate(status, 78)
|
276
|
+
self.last_status_length = len(status)
|
277
|
+
print status,
|
278
|
+
sys.stdout.flush()
|
279
|
+
|
280
|
+
|
281
|
+
class ColorProgressIndicator(CompactProgressIndicator):
|
282
|
+
|
283
|
+
def __init__(self, cases):
|
284
|
+
templates = {
|
285
|
+
'status_line': "[%(mins)02i:%(secs)02i|\033[34m%%%(remaining) 4d\033[0m|\033[32m+%(passed) 4d\033[0m|\033[31m-%(failed) 4d\033[0m]: %(test)s",
|
286
|
+
'stdout': "\033[1m%s\033[0m",
|
287
|
+
'stderr': "\033[31m%s\033[0m",
|
288
|
+
}
|
289
|
+
super(ColorProgressIndicator, self).__init__(cases, templates)
|
290
|
+
|
291
|
+
def ClearLine(self, last_line_length):
|
292
|
+
print "\033[1K\r",
|
293
|
+
|
294
|
+
|
295
|
+
class MonochromeProgressIndicator(CompactProgressIndicator):
|
296
|
+
|
297
|
+
def __init__(self, cases):
|
298
|
+
templates = {
|
299
|
+
'status_line': "[%(mins)02i:%(secs)02i|%%%(remaining) 4d|+%(passed) 4d|-%(failed) 4d]: %(test)s",
|
300
|
+
'stdout': '%s',
|
301
|
+
'stderr': '%s',
|
302
|
+
'clear': lambda last_line_length: ("\r" + (" " * last_line_length) + "\r"),
|
303
|
+
'max_length': 78
|
304
|
+
}
|
305
|
+
super(MonochromeProgressIndicator, self).__init__(cases, templates)
|
306
|
+
|
307
|
+
def ClearLine(self, last_line_length):
|
308
|
+
print ("\r" + (" " * last_line_length) + "\r"),
|
309
|
+
|
310
|
+
|
311
|
+
PROGRESS_INDICATORS = {
|
312
|
+
'verbose': VerboseProgressIndicator,
|
313
|
+
'dots': DotsProgressIndicator,
|
314
|
+
'color': ColorProgressIndicator,
|
315
|
+
'mono': MonochromeProgressIndicator
|
316
|
+
}
|
317
|
+
|
318
|
+
|
319
|
+
# -------------------------
|
320
|
+
# --- F r a m e w o r k ---
|
321
|
+
# -------------------------
|
322
|
+
|
323
|
+
class BreakNowException(Exception):
|
324
|
+
def __init__(self, value):
|
325
|
+
self.value = value
|
326
|
+
def __str__(self):
|
327
|
+
return repr(self.value)
|
328
|
+
|
329
|
+
|
330
|
+
class CommandOutput(object):
|
331
|
+
|
332
|
+
def __init__(self, exit_code, timed_out, stdout, stderr):
|
333
|
+
self.exit_code = exit_code
|
334
|
+
self.timed_out = timed_out
|
335
|
+
self.stdout = stdout
|
336
|
+
self.stderr = stderr
|
337
|
+
self.failed = None
|
338
|
+
|
339
|
+
|
340
|
+
class TestCase(object):
|
341
|
+
|
342
|
+
def __init__(self, context, path, mode):
|
343
|
+
self.path = path
|
344
|
+
self.context = context
|
345
|
+
self.duration = None
|
346
|
+
self.mode = mode
|
347
|
+
|
348
|
+
def IsNegative(self):
|
349
|
+
return False
|
350
|
+
|
351
|
+
def TestsIsolates(self):
|
352
|
+
return False
|
353
|
+
|
354
|
+
def CompareTime(self, other):
|
355
|
+
return cmp(other.duration, self.duration)
|
356
|
+
|
357
|
+
def DidFail(self, output):
|
358
|
+
if output.failed is None:
|
359
|
+
output.failed = self.IsFailureOutput(output)
|
360
|
+
return output.failed
|
361
|
+
|
362
|
+
def IsFailureOutput(self, output):
|
363
|
+
return output.exit_code != 0
|
364
|
+
|
365
|
+
def GetSource(self):
|
366
|
+
return "(no source available)"
|
367
|
+
|
368
|
+
def RunCommand(self, command):
|
369
|
+
full_command = self.context.processor(command)
|
370
|
+
output = Execute(full_command,
|
371
|
+
self.context,
|
372
|
+
self.context.GetTimeout(self, self.mode))
|
373
|
+
self.Cleanup()
|
374
|
+
return TestOutput(self,
|
375
|
+
full_command,
|
376
|
+
output,
|
377
|
+
self.context.store_unexpected_output)
|
378
|
+
|
379
|
+
def BeforeRun(self):
|
380
|
+
pass
|
381
|
+
|
382
|
+
def AfterRun(self, result):
|
383
|
+
pass
|
384
|
+
|
385
|
+
def GetCustomFlags(self, mode):
|
386
|
+
return None
|
387
|
+
|
388
|
+
def Run(self):
|
389
|
+
self.BeforeRun()
|
390
|
+
result = None
|
391
|
+
try:
|
392
|
+
result = self.RunCommand(self.GetCommand())
|
393
|
+
except:
|
394
|
+
self.terminate = True
|
395
|
+
raise BreakNowException("User pressed CTRL+C or IO went wrong")
|
396
|
+
finally:
|
397
|
+
self.AfterRun(result)
|
398
|
+
return result
|
399
|
+
|
400
|
+
def Cleanup(self):
|
401
|
+
return
|
402
|
+
|
403
|
+
|
404
|
+
class TestOutput(object):
|
405
|
+
|
406
|
+
def __init__(self, test, command, output, store_unexpected_output):
|
407
|
+
self.test = test
|
408
|
+
self.command = command
|
409
|
+
self.output = output
|
410
|
+
self.store_unexpected_output = store_unexpected_output
|
411
|
+
|
412
|
+
def UnexpectedOutput(self):
|
413
|
+
if self.HasCrashed():
|
414
|
+
outcome = CRASH
|
415
|
+
elif self.HasTimedOut():
|
416
|
+
outcome = TIMEOUT
|
417
|
+
elif self.HasFailed():
|
418
|
+
outcome = FAIL
|
419
|
+
else:
|
420
|
+
outcome = PASS
|
421
|
+
return not outcome in self.test.outcomes
|
422
|
+
|
423
|
+
def HasPreciousOutput(self):
|
424
|
+
return self.UnexpectedOutput() and self.store_unexpected_output
|
425
|
+
|
426
|
+
def HasCrashed(self):
|
427
|
+
if utils.IsWindows():
|
428
|
+
return 0x80000000 & self.output.exit_code and not (0x3FFFFF00 & self.output.exit_code)
|
429
|
+
else:
|
430
|
+
# Timed out tests will have exit_code -signal.SIGTERM.
|
431
|
+
if self.output.timed_out:
|
432
|
+
return False
|
433
|
+
return self.output.exit_code < 0 and \
|
434
|
+
self.output.exit_code != -signal.SIGABRT
|
435
|
+
|
436
|
+
def HasTimedOut(self):
|
437
|
+
return self.output.timed_out
|
438
|
+
|
439
|
+
def HasFailed(self):
|
440
|
+
execution_failed = self.test.DidFail(self.output)
|
441
|
+
if self.test.IsNegative():
|
442
|
+
return not execution_failed
|
443
|
+
else:
|
444
|
+
return execution_failed
|
445
|
+
|
446
|
+
|
447
|
+
def KillProcessWithID(pid):
|
448
|
+
if utils.IsWindows():
|
449
|
+
os.popen('taskkill /T /F /PID %d' % pid)
|
450
|
+
else:
|
451
|
+
os.kill(pid, signal.SIGTERM)
|
452
|
+
|
453
|
+
|
454
|
+
MAX_SLEEP_TIME = 0.1
|
455
|
+
INITIAL_SLEEP_TIME = 0.0001
|
456
|
+
SLEEP_TIME_FACTOR = 1.25
|
457
|
+
|
458
|
+
SEM_INVALID_VALUE = -1
|
459
|
+
SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h
|
460
|
+
|
461
|
+
def Win32SetErrorMode(mode):
|
462
|
+
prev_error_mode = SEM_INVALID_VALUE
|
463
|
+
try:
|
464
|
+
import ctypes
|
465
|
+
prev_error_mode = ctypes.windll.kernel32.SetErrorMode(mode)
|
466
|
+
except ImportError:
|
467
|
+
pass
|
468
|
+
return prev_error_mode
|
469
|
+
|
470
|
+
def RunProcess(context, timeout, args, **rest):
|
471
|
+
if context.verbose: print "#", " ".join(args)
|
472
|
+
popen_args = args
|
473
|
+
prev_error_mode = SEM_INVALID_VALUE
|
474
|
+
if utils.IsWindows():
|
475
|
+
popen_args = '"' + subprocess.list2cmdline(args) + '"'
|
476
|
+
if context.suppress_dialogs:
|
477
|
+
# Try to change the error mode to avoid dialogs on fatal errors. Don't
|
478
|
+
# touch any existing error mode flags by merging the existing error mode.
|
479
|
+
# See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx.
|
480
|
+
error_mode = SEM_NOGPFAULTERRORBOX
|
481
|
+
prev_error_mode = Win32SetErrorMode(error_mode)
|
482
|
+
Win32SetErrorMode(error_mode | prev_error_mode)
|
483
|
+
process = subprocess.Popen(
|
484
|
+
shell = utils.IsWindows(),
|
485
|
+
args = popen_args,
|
486
|
+
**rest
|
487
|
+
)
|
488
|
+
if utils.IsWindows() and context.suppress_dialogs and prev_error_mode != SEM_INVALID_VALUE:
|
489
|
+
Win32SetErrorMode(prev_error_mode)
|
490
|
+
# Compute the end time - if the process crosses this limit we
|
491
|
+
# consider it timed out.
|
492
|
+
if timeout is None: end_time = None
|
493
|
+
else: end_time = time.time() + timeout
|
494
|
+
timed_out = False
|
495
|
+
# Repeatedly check the exit code from the process in a
|
496
|
+
# loop and keep track of whether or not it times out.
|
497
|
+
exit_code = None
|
498
|
+
sleep_time = INITIAL_SLEEP_TIME
|
499
|
+
while exit_code is None:
|
500
|
+
if (not end_time is None) and (time.time() >= end_time):
|
501
|
+
# Kill the process and wait for it to exit.
|
502
|
+
KillProcessWithID(process.pid)
|
503
|
+
exit_code = process.wait()
|
504
|
+
timed_out = True
|
505
|
+
else:
|
506
|
+
exit_code = process.poll()
|
507
|
+
time.sleep(sleep_time)
|
508
|
+
sleep_time = sleep_time * SLEEP_TIME_FACTOR
|
509
|
+
if sleep_time > MAX_SLEEP_TIME:
|
510
|
+
sleep_time = MAX_SLEEP_TIME
|
511
|
+
return (process, exit_code, timed_out)
|
512
|
+
|
513
|
+
|
514
|
+
def PrintError(str):
|
515
|
+
sys.stderr.write(str)
|
516
|
+
sys.stderr.write('\n')
|
517
|
+
|
518
|
+
|
519
|
+
def CheckedUnlink(name):
|
520
|
+
# On Windows, when run with -jN in parallel processes,
|
521
|
+
# OS often fails to unlink the temp file. Not sure why.
|
522
|
+
# Need to retry.
|
523
|
+
# Idea from https://bugs.webkit.org/attachment.cgi?id=75982&action=prettypatch
|
524
|
+
retry_count = 0
|
525
|
+
while retry_count < 30:
|
526
|
+
try:
|
527
|
+
os.unlink(name)
|
528
|
+
return
|
529
|
+
except OSError, e:
|
530
|
+
retry_count += 1
|
531
|
+
time.sleep(retry_count * 0.1)
|
532
|
+
PrintError("os.unlink() " + str(e))
|
533
|
+
|
534
|
+
def Execute(args, context, timeout=None):
|
535
|
+
(fd_out, outname) = tempfile.mkstemp()
|
536
|
+
(fd_err, errname) = tempfile.mkstemp()
|
537
|
+
(process, exit_code, timed_out) = RunProcess(
|
538
|
+
context,
|
539
|
+
timeout,
|
540
|
+
args = args,
|
541
|
+
stdout = fd_out,
|
542
|
+
stderr = fd_err,
|
543
|
+
)
|
544
|
+
os.close(fd_out)
|
545
|
+
os.close(fd_err)
|
546
|
+
output = file(outname).read()
|
547
|
+
errors = file(errname).read()
|
548
|
+
CheckedUnlink(outname)
|
549
|
+
CheckedUnlink(errname)
|
550
|
+
return CommandOutput(exit_code, timed_out, output, errors)
|
551
|
+
|
552
|
+
|
553
|
+
def ExecuteNoCapture(args, context, timeout=None):
|
554
|
+
(process, exit_code, timed_out) = RunProcess(
|
555
|
+
context,
|
556
|
+
timeout,
|
557
|
+
args = args,
|
558
|
+
)
|
559
|
+
return CommandOutput(exit_code, False, "", "")
|
560
|
+
|
561
|
+
|
562
|
+
def CarCdr(path):
|
563
|
+
if len(path) == 0:
|
564
|
+
return (None, [ ])
|
565
|
+
else:
|
566
|
+
return (path[0], path[1:])
|
567
|
+
|
568
|
+
|
569
|
+
# Use this to run several variants of the tests, e.g.:
|
570
|
+
# VARIANT_FLAGS = [[], ['--always_compact', '--noflush_code']]
|
571
|
+
VARIANT_FLAGS = [[],
|
572
|
+
['--stress-opt', '--always-opt'],
|
573
|
+
['--nocrankshaft']]
|
574
|
+
|
575
|
+
|
576
|
+
class TestConfiguration(object):
|
577
|
+
|
578
|
+
def __init__(self, context, root):
|
579
|
+
self.context = context
|
580
|
+
self.root = root
|
581
|
+
|
582
|
+
def Contains(self, path, file):
|
583
|
+
if len(path) > len(file):
|
584
|
+
return False
|
585
|
+
for i in xrange(len(path)):
|
586
|
+
if not path[i].match(file[i]):
|
587
|
+
return False
|
588
|
+
return True
|
589
|
+
|
590
|
+
def GetTestStatus(self, sections, defs):
|
591
|
+
pass
|
592
|
+
|
593
|
+
def VariantFlags(self):
|
594
|
+
return VARIANT_FLAGS
|
595
|
+
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
class TestSuite(object):
|
600
|
+
|
601
|
+
def __init__(self, name):
|
602
|
+
self.name = name
|
603
|
+
|
604
|
+
def GetName(self):
|
605
|
+
return self.name
|
606
|
+
|
607
|
+
|
608
|
+
class TestRepository(TestSuite):
|
609
|
+
|
610
|
+
def __init__(self, path):
|
611
|
+
normalized_path = abspath(path)
|
612
|
+
super(TestRepository, self).__init__(basename(normalized_path))
|
613
|
+
self.path = normalized_path
|
614
|
+
self.is_loaded = False
|
615
|
+
self.config = None
|
616
|
+
|
617
|
+
def GetConfiguration(self, context):
|
618
|
+
if self.is_loaded:
|
619
|
+
return self.config
|
620
|
+
self.is_loaded = True
|
621
|
+
file = None
|
622
|
+
try:
|
623
|
+
(file, pathname, description) = imp.find_module('testcfg', [ self.path ])
|
624
|
+
module = imp.load_module('testcfg', file, pathname, description)
|
625
|
+
self.config = module.GetConfiguration(context, self.path)
|
626
|
+
finally:
|
627
|
+
if file:
|
628
|
+
file.close()
|
629
|
+
return self.config
|
630
|
+
|
631
|
+
def GetBuildRequirements(self, path, context):
|
632
|
+
return self.GetConfiguration(context).GetBuildRequirements()
|
633
|
+
|
634
|
+
def AddTestsToList(self, result, current_path, path, context, mode):
|
635
|
+
for v in self.GetConfiguration(context).VariantFlags():
|
636
|
+
tests = self.GetConfiguration(context).ListTests(current_path, path, mode, v)
|
637
|
+
for t in tests: t.variant_flags = v
|
638
|
+
result += tests
|
639
|
+
|
640
|
+
def GetTestStatus(self, context, sections, defs):
|
641
|
+
self.GetConfiguration(context).GetTestStatus(sections, defs)
|
642
|
+
|
643
|
+
|
644
|
+
class LiteralTestSuite(TestSuite):
|
645
|
+
|
646
|
+
def __init__(self, tests):
|
647
|
+
super(LiteralTestSuite, self).__init__('root')
|
648
|
+
self.tests = tests
|
649
|
+
|
650
|
+
def GetBuildRequirements(self, path, context):
|
651
|
+
(name, rest) = CarCdr(path)
|
652
|
+
result = [ ]
|
653
|
+
for test in self.tests:
|
654
|
+
if not name or name.match(test.GetName()):
|
655
|
+
result += test.GetBuildRequirements(rest, context)
|
656
|
+
return result
|
657
|
+
|
658
|
+
def ListTests(self, current_path, path, context, mode, variant_flags):
|
659
|
+
(name, rest) = CarCdr(path)
|
660
|
+
result = [ ]
|
661
|
+
for test in self.tests:
|
662
|
+
test_name = test.GetName()
|
663
|
+
if not name or name.match(test_name):
|
664
|
+
full_path = current_path + [test_name]
|
665
|
+
test.AddTestsToList(result, full_path, path, context, mode)
|
666
|
+
return result
|
667
|
+
|
668
|
+
def GetTestStatus(self, context, sections, defs):
|
669
|
+
for test in self.tests:
|
670
|
+
test.GetTestStatus(context, sections, defs)
|
671
|
+
|
672
|
+
|
673
|
+
SUFFIX = {
|
674
|
+
'debug' : '_g',
|
675
|
+
'release' : '' }
|
676
|
+
FLAGS = {
|
677
|
+
'debug' : ['--enable-slow-asserts', '--debug-code', '--verify-heap'],
|
678
|
+
'release' : []}
|
679
|
+
TIMEOUT_SCALEFACTOR = {
|
680
|
+
'debug' : 4,
|
681
|
+
'release' : 1 }
|
682
|
+
|
683
|
+
|
684
|
+
class Context(object):
|
685
|
+
|
686
|
+
def __init__(self, workspace, buildspace, verbose, vm, timeout, processor, suppress_dialogs, store_unexpected_output):
|
687
|
+
self.workspace = workspace
|
688
|
+
self.buildspace = buildspace
|
689
|
+
self.verbose = verbose
|
690
|
+
self.vm_root = vm
|
691
|
+
self.timeout = timeout
|
692
|
+
self.processor = processor
|
693
|
+
self.suppress_dialogs = suppress_dialogs
|
694
|
+
self.store_unexpected_output = store_unexpected_output
|
695
|
+
|
696
|
+
def GetVm(self, mode):
|
697
|
+
name = self.vm_root + SUFFIX[mode]
|
698
|
+
if utils.IsWindows() and not name.endswith('.exe'):
|
699
|
+
name = name + '.exe'
|
700
|
+
return name
|
701
|
+
|
702
|
+
def GetVmCommand(self, testcase, mode):
|
703
|
+
return [self.GetVm(mode)] + self.GetVmFlags(testcase, mode)
|
704
|
+
|
705
|
+
def GetVmFlags(self, testcase, mode):
|
706
|
+
flags = testcase.GetCustomFlags(mode)
|
707
|
+
if flags is None:
|
708
|
+
flags = FLAGS[mode]
|
709
|
+
return testcase.variant_flags + flags
|
710
|
+
|
711
|
+
def GetTimeout(self, testcase, mode):
|
712
|
+
result = self.timeout * TIMEOUT_SCALEFACTOR[mode]
|
713
|
+
if '--stress-opt' in self.GetVmFlags(testcase, mode):
|
714
|
+
return result * 2
|
715
|
+
else:
|
716
|
+
return result
|
717
|
+
|
718
|
+
def RunTestCases(cases_to_run, progress, tasks):
|
719
|
+
progress = PROGRESS_INDICATORS[progress](cases_to_run)
|
720
|
+
result = 0
|
721
|
+
try:
|
722
|
+
result = progress.Run(tasks)
|
723
|
+
except Exception, e:
|
724
|
+
print "\n", e
|
725
|
+
return result
|
726
|
+
|
727
|
+
|
728
|
+
def BuildRequirements(context, requirements, mode, scons_flags):
|
729
|
+
command_line = (['scons', '-Y', context.workspace, 'mode=' + ",".join(mode)]
|
730
|
+
+ requirements
|
731
|
+
+ scons_flags)
|
732
|
+
output = ExecuteNoCapture(command_line, context)
|
733
|
+
return output.exit_code == 0
|
734
|
+
|
735
|
+
|
736
|
+
# -------------------------------------------
|
737
|
+
# --- T e s t C o n f i g u r a t i o n ---
|
738
|
+
# -------------------------------------------
|
739
|
+
|
740
|
+
|
741
|
+
SKIP = 'skip'
|
742
|
+
FAIL = 'fail'
|
743
|
+
PASS = 'pass'
|
744
|
+
OKAY = 'okay'
|
745
|
+
TIMEOUT = 'timeout'
|
746
|
+
CRASH = 'crash'
|
747
|
+
SLOW = 'slow'
|
748
|
+
|
749
|
+
|
750
|
+
class Expression(object):
|
751
|
+
pass
|
752
|
+
|
753
|
+
|
754
|
+
class Constant(Expression):
|
755
|
+
|
756
|
+
def __init__(self, value):
|
757
|
+
self.value = value
|
758
|
+
|
759
|
+
def Evaluate(self, env, defs):
|
760
|
+
return self.value
|
761
|
+
|
762
|
+
|
763
|
+
class Variable(Expression):
|
764
|
+
|
765
|
+
def __init__(self, name):
|
766
|
+
self.name = name
|
767
|
+
|
768
|
+
def GetOutcomes(self, env, defs):
|
769
|
+
if self.name in env: return ListSet([env[self.name]])
|
770
|
+
else: return Nothing()
|
771
|
+
|
772
|
+
def Evaluate(self, env, defs):
|
773
|
+
return env[self.name]
|
774
|
+
|
775
|
+
|
776
|
+
class Outcome(Expression):
|
777
|
+
|
778
|
+
def __init__(self, name):
|
779
|
+
self.name = name
|
780
|
+
|
781
|
+
def GetOutcomes(self, env, defs):
|
782
|
+
if self.name in defs:
|
783
|
+
return defs[self.name].GetOutcomes(env, defs)
|
784
|
+
else:
|
785
|
+
return ListSet([self.name])
|
786
|
+
|
787
|
+
|
788
|
+
class Set(object):
|
789
|
+
pass
|
790
|
+
|
791
|
+
|
792
|
+
class ListSet(Set):
|
793
|
+
|
794
|
+
def __init__(self, elms):
|
795
|
+
self.elms = elms
|
796
|
+
|
797
|
+
def __str__(self):
|
798
|
+
return "ListSet%s" % str(self.elms)
|
799
|
+
|
800
|
+
def Intersect(self, that):
|
801
|
+
if not isinstance(that, ListSet):
|
802
|
+
return that.Intersect(self)
|
803
|
+
return ListSet([ x for x in self.elms if x in that.elms ])
|
804
|
+
|
805
|
+
def Union(self, that):
|
806
|
+
if not isinstance(that, ListSet):
|
807
|
+
return that.Union(self)
|
808
|
+
return ListSet(self.elms + [ x for x in that.elms if x not in self.elms ])
|
809
|
+
|
810
|
+
def IsEmpty(self):
|
811
|
+
return len(self.elms) == 0
|
812
|
+
|
813
|
+
|
814
|
+
class Everything(Set):
|
815
|
+
|
816
|
+
def Intersect(self, that):
|
817
|
+
return that
|
818
|
+
|
819
|
+
def Union(self, that):
|
820
|
+
return self
|
821
|
+
|
822
|
+
def IsEmpty(self):
|
823
|
+
return False
|
824
|
+
|
825
|
+
|
826
|
+
class Nothing(Set):
|
827
|
+
|
828
|
+
def Intersect(self, that):
|
829
|
+
return self
|
830
|
+
|
831
|
+
def Union(self, that):
|
832
|
+
return that
|
833
|
+
|
834
|
+
def IsEmpty(self):
|
835
|
+
return True
|
836
|
+
|
837
|
+
|
838
|
+
class Operation(Expression):
|
839
|
+
|
840
|
+
def __init__(self, left, op, right):
|
841
|
+
self.left = left
|
842
|
+
self.op = op
|
843
|
+
self.right = right
|
844
|
+
|
845
|
+
def Evaluate(self, env, defs):
|
846
|
+
if self.op == '||' or self.op == ',':
|
847
|
+
return self.left.Evaluate(env, defs) or self.right.Evaluate(env, defs)
|
848
|
+
elif self.op == 'if':
|
849
|
+
return False
|
850
|
+
elif self.op == '==':
|
851
|
+
inter = self.left.GetOutcomes(env, defs).Intersect(self.right.GetOutcomes(env, defs))
|
852
|
+
return not inter.IsEmpty()
|
853
|
+
else:
|
854
|
+
assert self.op == '&&'
|
855
|
+
return self.left.Evaluate(env, defs) and self.right.Evaluate(env, defs)
|
856
|
+
|
857
|
+
def GetOutcomes(self, env, defs):
|
858
|
+
if self.op == '||' or self.op == ',':
|
859
|
+
return self.left.GetOutcomes(env, defs).Union(self.right.GetOutcomes(env, defs))
|
860
|
+
elif self.op == 'if':
|
861
|
+
if self.right.Evaluate(env, defs): return self.left.GetOutcomes(env, defs)
|
862
|
+
else: return Nothing()
|
863
|
+
else:
|
864
|
+
assert self.op == '&&'
|
865
|
+
return self.left.GetOutcomes(env, defs).Intersect(self.right.GetOutcomes(env, defs))
|
866
|
+
|
867
|
+
|
868
|
+
def IsAlpha(str):
|
869
|
+
for char in str:
|
870
|
+
if not (char.isalpha() or char.isdigit() or char == '_'):
|
871
|
+
return False
|
872
|
+
return True
|
873
|
+
|
874
|
+
|
875
|
+
class Tokenizer(object):
|
876
|
+
"""A simple string tokenizer that chops expressions into variables,
|
877
|
+
parens and operators"""
|
878
|
+
|
879
|
+
def __init__(self, expr):
|
880
|
+
self.index = 0
|
881
|
+
self.expr = expr
|
882
|
+
self.length = len(expr)
|
883
|
+
self.tokens = None
|
884
|
+
|
885
|
+
def Current(self, length = 1):
|
886
|
+
if not self.HasMore(length): return ""
|
887
|
+
return self.expr[self.index:self.index+length]
|
888
|
+
|
889
|
+
def HasMore(self, length = 1):
|
890
|
+
return self.index < self.length + (length - 1)
|
891
|
+
|
892
|
+
def Advance(self, count = 1):
|
893
|
+
self.index = self.index + count
|
894
|
+
|
895
|
+
def AddToken(self, token):
|
896
|
+
self.tokens.append(token)
|
897
|
+
|
898
|
+
def SkipSpaces(self):
|
899
|
+
while self.HasMore() and self.Current().isspace():
|
900
|
+
self.Advance()
|
901
|
+
|
902
|
+
def Tokenize(self):
|
903
|
+
self.tokens = [ ]
|
904
|
+
while self.HasMore():
|
905
|
+
self.SkipSpaces()
|
906
|
+
if not self.HasMore():
|
907
|
+
return None
|
908
|
+
if self.Current() == '(':
|
909
|
+
self.AddToken('(')
|
910
|
+
self.Advance()
|
911
|
+
elif self.Current() == ')':
|
912
|
+
self.AddToken(')')
|
913
|
+
self.Advance()
|
914
|
+
elif self.Current() == '$':
|
915
|
+
self.AddToken('$')
|
916
|
+
self.Advance()
|
917
|
+
elif self.Current() == ',':
|
918
|
+
self.AddToken(',')
|
919
|
+
self.Advance()
|
920
|
+
elif IsAlpha(self.Current()):
|
921
|
+
buf = ""
|
922
|
+
while self.HasMore() and IsAlpha(self.Current()):
|
923
|
+
buf += self.Current()
|
924
|
+
self.Advance()
|
925
|
+
self.AddToken(buf)
|
926
|
+
elif self.Current(2) == '&&':
|
927
|
+
self.AddToken('&&')
|
928
|
+
self.Advance(2)
|
929
|
+
elif self.Current(2) == '||':
|
930
|
+
self.AddToken('||')
|
931
|
+
self.Advance(2)
|
932
|
+
elif self.Current(2) == '==':
|
933
|
+
self.AddToken('==')
|
934
|
+
self.Advance(2)
|
935
|
+
else:
|
936
|
+
return None
|
937
|
+
return self.tokens
|
938
|
+
|
939
|
+
|
940
|
+
class Scanner(object):
|
941
|
+
"""A simple scanner that can serve out tokens from a given list"""
|
942
|
+
|
943
|
+
def __init__(self, tokens):
|
944
|
+
self.tokens = tokens
|
945
|
+
self.length = len(tokens)
|
946
|
+
self.index = 0
|
947
|
+
|
948
|
+
def HasMore(self):
|
949
|
+
return self.index < self.length
|
950
|
+
|
951
|
+
def Current(self):
|
952
|
+
return self.tokens[self.index]
|
953
|
+
|
954
|
+
def Advance(self):
|
955
|
+
self.index = self.index + 1
|
956
|
+
|
957
|
+
|
958
|
+
def ParseAtomicExpression(scan):
|
959
|
+
if scan.Current() == "true":
|
960
|
+
scan.Advance()
|
961
|
+
return Constant(True)
|
962
|
+
elif scan.Current() == "false":
|
963
|
+
scan.Advance()
|
964
|
+
return Constant(False)
|
965
|
+
elif IsAlpha(scan.Current()):
|
966
|
+
name = scan.Current()
|
967
|
+
scan.Advance()
|
968
|
+
return Outcome(name.lower())
|
969
|
+
elif scan.Current() == '$':
|
970
|
+
scan.Advance()
|
971
|
+
if not IsAlpha(scan.Current()):
|
972
|
+
return None
|
973
|
+
name = scan.Current()
|
974
|
+
scan.Advance()
|
975
|
+
return Variable(name.lower())
|
976
|
+
elif scan.Current() == '(':
|
977
|
+
scan.Advance()
|
978
|
+
result = ParseLogicalExpression(scan)
|
979
|
+
if (not result) or (scan.Current() != ')'):
|
980
|
+
return None
|
981
|
+
scan.Advance()
|
982
|
+
return result
|
983
|
+
else:
|
984
|
+
return None
|
985
|
+
|
986
|
+
|
987
|
+
BINARIES = ['==']
|
988
|
+
def ParseOperatorExpression(scan):
|
989
|
+
left = ParseAtomicExpression(scan)
|
990
|
+
if not left: return None
|
991
|
+
while scan.HasMore() and (scan.Current() in BINARIES):
|
992
|
+
op = scan.Current()
|
993
|
+
scan.Advance()
|
994
|
+
right = ParseOperatorExpression(scan)
|
995
|
+
if not right:
|
996
|
+
return None
|
997
|
+
left = Operation(left, op, right)
|
998
|
+
return left
|
999
|
+
|
1000
|
+
|
1001
|
+
def ParseConditionalExpression(scan):
|
1002
|
+
left = ParseOperatorExpression(scan)
|
1003
|
+
if not left: return None
|
1004
|
+
while scan.HasMore() and (scan.Current() == 'if'):
|
1005
|
+
scan.Advance()
|
1006
|
+
right = ParseOperatorExpression(scan)
|
1007
|
+
if not right:
|
1008
|
+
return None
|
1009
|
+
left= Operation(left, 'if', right)
|
1010
|
+
return left
|
1011
|
+
|
1012
|
+
|
1013
|
+
LOGICALS = ["&&", "||", ","]
|
1014
|
+
def ParseLogicalExpression(scan):
|
1015
|
+
left = ParseConditionalExpression(scan)
|
1016
|
+
if not left: return None
|
1017
|
+
while scan.HasMore() and (scan.Current() in LOGICALS):
|
1018
|
+
op = scan.Current()
|
1019
|
+
scan.Advance()
|
1020
|
+
right = ParseConditionalExpression(scan)
|
1021
|
+
if not right:
|
1022
|
+
return None
|
1023
|
+
left = Operation(left, op, right)
|
1024
|
+
return left
|
1025
|
+
|
1026
|
+
|
1027
|
+
def ParseCondition(expr):
|
1028
|
+
"""Parses a logical expression into an Expression object"""
|
1029
|
+
tokens = Tokenizer(expr).Tokenize()
|
1030
|
+
if not tokens:
|
1031
|
+
print "Malformed expression: '%s'" % expr
|
1032
|
+
return None
|
1033
|
+
scan = Scanner(tokens)
|
1034
|
+
ast = ParseLogicalExpression(scan)
|
1035
|
+
if not ast:
|
1036
|
+
print "Malformed expression: '%s'" % expr
|
1037
|
+
return None
|
1038
|
+
if scan.HasMore():
|
1039
|
+
print "Malformed expression: '%s'" % expr
|
1040
|
+
return None
|
1041
|
+
return ast
|
1042
|
+
|
1043
|
+
|
1044
|
+
class ClassifiedTest(object):
|
1045
|
+
|
1046
|
+
def __init__(self, case, outcomes):
|
1047
|
+
self.case = case
|
1048
|
+
self.outcomes = outcomes
|
1049
|
+
|
1050
|
+
def TestsIsolates(self):
|
1051
|
+
return self.case.TestsIsolates()
|
1052
|
+
|
1053
|
+
|
1054
|
+
class Configuration(object):
|
1055
|
+
"""The parsed contents of a configuration file"""
|
1056
|
+
|
1057
|
+
def __init__(self, sections, defs):
|
1058
|
+
self.sections = sections
|
1059
|
+
self.defs = defs
|
1060
|
+
|
1061
|
+
def ClassifyTests(self, cases, env):
|
1062
|
+
sections = [s for s in self.sections if s.condition.Evaluate(env, self.defs)]
|
1063
|
+
all_rules = reduce(list.__add__, [s.rules for s in sections], [])
|
1064
|
+
unused_rules = set(all_rules)
|
1065
|
+
result = [ ]
|
1066
|
+
all_outcomes = set([])
|
1067
|
+
for case in cases:
|
1068
|
+
matches = [ r for r in all_rules if r.Contains(case.path) ]
|
1069
|
+
outcomes = set([])
|
1070
|
+
for rule in matches:
|
1071
|
+
outcomes = outcomes.union(rule.GetOutcomes(env, self.defs))
|
1072
|
+
unused_rules.discard(rule)
|
1073
|
+
if not outcomes:
|
1074
|
+
outcomes = [PASS]
|
1075
|
+
case.outcomes = outcomes
|
1076
|
+
all_outcomes = all_outcomes.union(outcomes)
|
1077
|
+
result.append(ClassifiedTest(case, outcomes))
|
1078
|
+
return (result, list(unused_rules), all_outcomes)
|
1079
|
+
|
1080
|
+
|
1081
|
+
class Section(object):
|
1082
|
+
"""A section of the configuration file. Sections are enabled or
|
1083
|
+
disabled prior to running the tests, based on their conditions"""
|
1084
|
+
|
1085
|
+
def __init__(self, condition):
|
1086
|
+
self.condition = condition
|
1087
|
+
self.rules = [ ]
|
1088
|
+
|
1089
|
+
def AddRule(self, rule):
|
1090
|
+
self.rules.append(rule)
|
1091
|
+
|
1092
|
+
|
1093
|
+
class Rule(object):
|
1094
|
+
"""A single rule that specifies the expected outcome for a single
|
1095
|
+
test."""
|
1096
|
+
|
1097
|
+
def __init__(self, raw_path, path, value):
|
1098
|
+
self.raw_path = raw_path
|
1099
|
+
self.path = path
|
1100
|
+
self.value = value
|
1101
|
+
|
1102
|
+
def GetOutcomes(self, env, defs):
|
1103
|
+
set = self.value.GetOutcomes(env, defs)
|
1104
|
+
assert isinstance(set, ListSet)
|
1105
|
+
return set.elms
|
1106
|
+
|
1107
|
+
def Contains(self, path):
|
1108
|
+
if len(self.path) > len(path):
|
1109
|
+
return False
|
1110
|
+
for i in xrange(len(self.path)):
|
1111
|
+
if not self.path[i].match(path[i]):
|
1112
|
+
return False
|
1113
|
+
return True
|
1114
|
+
|
1115
|
+
|
1116
|
+
HEADER_PATTERN = re.compile(r'\[([^]]+)\]')
|
1117
|
+
RULE_PATTERN = re.compile(r'\s*([^: ]*)\s*:(.*)')
|
1118
|
+
DEF_PATTERN = re.compile(r'^def\s*(\w+)\s*=(.*)$')
|
1119
|
+
PREFIX_PATTERN = re.compile(r'^\s*prefix\s+([\w\_\.\-\/]+)$')
|
1120
|
+
|
1121
|
+
|
1122
|
+
def ReadConfigurationInto(path, sections, defs):
|
1123
|
+
current_section = Section(Constant(True))
|
1124
|
+
sections.append(current_section)
|
1125
|
+
prefix = []
|
1126
|
+
for line in utils.ReadLinesFrom(path):
|
1127
|
+
header_match = HEADER_PATTERN.match(line)
|
1128
|
+
if header_match:
|
1129
|
+
condition_str = header_match.group(1).strip()
|
1130
|
+
condition = ParseCondition(condition_str)
|
1131
|
+
new_section = Section(condition)
|
1132
|
+
sections.append(new_section)
|
1133
|
+
current_section = new_section
|
1134
|
+
continue
|
1135
|
+
rule_match = RULE_PATTERN.match(line)
|
1136
|
+
if rule_match:
|
1137
|
+
path = prefix + SplitPath(rule_match.group(1).strip())
|
1138
|
+
value_str = rule_match.group(2).strip()
|
1139
|
+
value = ParseCondition(value_str)
|
1140
|
+
if not value:
|
1141
|
+
return False
|
1142
|
+
current_section.AddRule(Rule(rule_match.group(1), path, value))
|
1143
|
+
continue
|
1144
|
+
def_match = DEF_PATTERN.match(line)
|
1145
|
+
if def_match:
|
1146
|
+
name = def_match.group(1).lower()
|
1147
|
+
value = ParseCondition(def_match.group(2).strip())
|
1148
|
+
if not value:
|
1149
|
+
return False
|
1150
|
+
defs[name] = value
|
1151
|
+
continue
|
1152
|
+
prefix_match = PREFIX_PATTERN.match(line)
|
1153
|
+
if prefix_match:
|
1154
|
+
prefix = SplitPath(prefix_match.group(1).strip())
|
1155
|
+
continue
|
1156
|
+
print "Malformed line: '%s'." % line
|
1157
|
+
return False
|
1158
|
+
return True
|
1159
|
+
|
1160
|
+
|
1161
|
+
# ---------------
|
1162
|
+
# --- M a i n ---
|
1163
|
+
# ---------------
|
1164
|
+
|
1165
|
+
|
1166
|
+
ARCH_GUESS = utils.GuessArchitecture()
|
1167
|
+
|
1168
|
+
|
1169
|
+
def BuildOptions():
|
1170
|
+
result = optparse.OptionParser()
|
1171
|
+
result.add_option("-m", "--mode", help="The test modes in which to run (comma-separated)",
|
1172
|
+
default='release')
|
1173
|
+
result.add_option("-v", "--verbose", help="Verbose output",
|
1174
|
+
default=False, action="store_true")
|
1175
|
+
result.add_option("-S", dest="scons_flags", help="Flag to pass through to scons",
|
1176
|
+
default=[], action="append")
|
1177
|
+
result.add_option("-p", "--progress",
|
1178
|
+
help="The style of progress indicator (verbose, dots, color, mono)",
|
1179
|
+
choices=PROGRESS_INDICATORS.keys(), default="mono")
|
1180
|
+
result.add_option("--no-build", help="Don't build requirements",
|
1181
|
+
default=False, action="store_true")
|
1182
|
+
result.add_option("--build-only", help="Only build requirements, don't run the tests",
|
1183
|
+
default=False, action="store_true")
|
1184
|
+
result.add_option("--report", help="Print a summary of the tests to be run",
|
1185
|
+
default=False, action="store_true")
|
1186
|
+
result.add_option("-s", "--suite", help="A test suite",
|
1187
|
+
default=[], action="append")
|
1188
|
+
result.add_option("-t", "--timeout", help="Timeout in seconds",
|
1189
|
+
default=60, type="int")
|
1190
|
+
result.add_option("--arch", help='The architecture to run tests for',
|
1191
|
+
default='none')
|
1192
|
+
result.add_option("--snapshot", help="Run the tests with snapshot turned on",
|
1193
|
+
default=False, action="store_true")
|
1194
|
+
result.add_option("--simulator", help="Run tests with architecture simulator",
|
1195
|
+
default='none')
|
1196
|
+
result.add_option("--special-command", default=None)
|
1197
|
+
result.add_option("--valgrind", help="Run tests through valgrind",
|
1198
|
+
default=False, action="store_true")
|
1199
|
+
result.add_option("--cat", help="Print the source of the tests",
|
1200
|
+
default=False, action="store_true")
|
1201
|
+
result.add_option("--warn-unused", help="Report unused rules",
|
1202
|
+
default=False, action="store_true")
|
1203
|
+
result.add_option("-j", help="The number of parallel tasks to run",
|
1204
|
+
default=1, type="int")
|
1205
|
+
result.add_option("--time", help="Print timing information after running",
|
1206
|
+
default=False, action="store_true")
|
1207
|
+
result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests",
|
1208
|
+
dest="suppress_dialogs", default=True, action="store_true")
|
1209
|
+
result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests",
|
1210
|
+
dest="suppress_dialogs", action="store_false")
|
1211
|
+
result.add_option("--shell", help="Path to V8 shell", default="shell")
|
1212
|
+
result.add_option("--isolates", help="Whether to test isolates", default=False, action="store_true")
|
1213
|
+
result.add_option("--store-unexpected-output",
|
1214
|
+
help="Store the temporary JS files from tests that fails",
|
1215
|
+
dest="store_unexpected_output", default=True, action="store_true")
|
1216
|
+
result.add_option("--no-store-unexpected-output",
|
1217
|
+
help="Deletes the temporary JS files from tests that fails",
|
1218
|
+
dest="store_unexpected_output", action="store_false")
|
1219
|
+
result.add_option("--stress-only",
|
1220
|
+
help="Only run tests with --always-opt --stress-opt",
|
1221
|
+
default=False, action="store_true")
|
1222
|
+
result.add_option("--nostress",
|
1223
|
+
help="Don't run crankshaft --always-opt --stress-op test",
|
1224
|
+
default=False, action="store_true")
|
1225
|
+
result.add_option("--crankshaft",
|
1226
|
+
help="Run with the --crankshaft flag",
|
1227
|
+
default=False, action="store_true")
|
1228
|
+
result.add_option("--shard-count",
|
1229
|
+
help="Split testsuites into this number of shards",
|
1230
|
+
default=1, type="int")
|
1231
|
+
result.add_option("--shard-run",
|
1232
|
+
help="Run this shard from the split up tests.",
|
1233
|
+
default=1, type="int")
|
1234
|
+
result.add_option("--noprof", help="Disable profiling support",
|
1235
|
+
default=False)
|
1236
|
+
return result
|
1237
|
+
|
1238
|
+
|
1239
|
+
def ProcessOptions(options):
|
1240
|
+
global VERBOSE
|
1241
|
+
VERBOSE = options.verbose
|
1242
|
+
options.mode = options.mode.split(',')
|
1243
|
+
for mode in options.mode:
|
1244
|
+
if not mode in ['debug', 'release']:
|
1245
|
+
print "Unknown mode %s" % mode
|
1246
|
+
return False
|
1247
|
+
if options.simulator != 'none':
|
1248
|
+
# Simulator argument was set. Make sure arch and simulator agree.
|
1249
|
+
if options.simulator != options.arch:
|
1250
|
+
if options.arch == 'none':
|
1251
|
+
options.arch = options.simulator
|
1252
|
+
else:
|
1253
|
+
print "Architecture %s does not match sim %s" %(options.arch, options.simulator)
|
1254
|
+
return False
|
1255
|
+
# Ensure that the simulator argument is handed down to scons.
|
1256
|
+
options.scons_flags.append("simulator=" + options.simulator)
|
1257
|
+
else:
|
1258
|
+
# If options.arch is not set by the command line and no simulator setting
|
1259
|
+
# was found, set the arch to the guess.
|
1260
|
+
if options.arch == 'none':
|
1261
|
+
options.arch = ARCH_GUESS
|
1262
|
+
options.scons_flags.append("arch=" + options.arch)
|
1263
|
+
if options.snapshot:
|
1264
|
+
options.scons_flags.append("snapshot=on")
|
1265
|
+
global VARIANT_FLAGS
|
1266
|
+
if options.stress_only:
|
1267
|
+
VARIANT_FLAGS = [['--stress-opt', '--always-opt']]
|
1268
|
+
if options.nostress:
|
1269
|
+
VARIANT_FLAGS = [[],['--nocrankshaft']]
|
1270
|
+
if options.crankshaft:
|
1271
|
+
if options.special_command:
|
1272
|
+
options.special_command += " --crankshaft"
|
1273
|
+
else:
|
1274
|
+
options.special_command = "@--crankshaft"
|
1275
|
+
if options.noprof:
|
1276
|
+
options.scons_flags.append("prof=off")
|
1277
|
+
options.scons_flags.append("profilingsupport=off")
|
1278
|
+
return True
|
1279
|
+
|
1280
|
+
|
1281
|
+
REPORT_TEMPLATE = """\
|
1282
|
+
Total: %(total)i tests
|
1283
|
+
* %(skipped)4d tests will be skipped
|
1284
|
+
* %(nocrash)4d tests are expected to be flaky but not crash
|
1285
|
+
* %(pass)4d tests are expected to pass
|
1286
|
+
* %(fail_ok)4d tests are expected to fail that we won't fix
|
1287
|
+
* %(fail)4d tests are expected to fail that we should fix\
|
1288
|
+
"""
|
1289
|
+
|
1290
|
+
def PrintReport(cases):
|
1291
|
+
def IsFlaky(o):
|
1292
|
+
return (PASS in o) and (FAIL in o) and (not CRASH in o) and (not OKAY in o)
|
1293
|
+
def IsFailOk(o):
|
1294
|
+
return (len(o) == 2) and (FAIL in o) and (OKAY in o)
|
1295
|
+
unskipped = [c for c in cases if not SKIP in c.outcomes]
|
1296
|
+
print REPORT_TEMPLATE % {
|
1297
|
+
'total': len(cases),
|
1298
|
+
'skipped': len(cases) - len(unskipped),
|
1299
|
+
'nocrash': len([t for t in unskipped if IsFlaky(t.outcomes)]),
|
1300
|
+
'pass': len([t for t in unskipped if list(t.outcomes) == [PASS]]),
|
1301
|
+
'fail_ok': len([t for t in unskipped if IsFailOk(t.outcomes)]),
|
1302
|
+
'fail': len([t for t in unskipped if list(t.outcomes) == [FAIL]])
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
|
1306
|
+
class Pattern(object):
|
1307
|
+
|
1308
|
+
def __init__(self, pattern):
|
1309
|
+
self.pattern = pattern
|
1310
|
+
self.compiled = None
|
1311
|
+
|
1312
|
+
def match(self, str):
|
1313
|
+
if not self.compiled:
|
1314
|
+
pattern = "^" + self.pattern.replace('*', '.*') + "$"
|
1315
|
+
self.compiled = re.compile(pattern)
|
1316
|
+
return self.compiled.match(str)
|
1317
|
+
|
1318
|
+
def __str__(self):
|
1319
|
+
return self.pattern
|
1320
|
+
|
1321
|
+
|
1322
|
+
def SplitPath(s):
|
1323
|
+
stripped = [ c.strip() for c in s.split('/') ]
|
1324
|
+
return [ Pattern(s) for s in stripped if len(s) > 0 ]
|
1325
|
+
|
1326
|
+
|
1327
|
+
def GetSpecialCommandProcessor(value):
|
1328
|
+
if (not value) or (value.find('@') == -1):
|
1329
|
+
def ExpandCommand(args):
|
1330
|
+
return args
|
1331
|
+
return ExpandCommand
|
1332
|
+
else:
|
1333
|
+
pos = value.find('@')
|
1334
|
+
import urllib
|
1335
|
+
prefix = urllib.unquote(value[:pos]).split()
|
1336
|
+
suffix = urllib.unquote(value[pos+1:]).split()
|
1337
|
+
def ExpandCommand(args):
|
1338
|
+
return prefix + args + suffix
|
1339
|
+
return ExpandCommand
|
1340
|
+
|
1341
|
+
|
1342
|
+
BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message', 'preparser']
|
1343
|
+
|
1344
|
+
|
1345
|
+
def GetSuites(test_root):
|
1346
|
+
def IsSuite(path):
|
1347
|
+
return isdir(path) and exists(join(path, 'testcfg.py'))
|
1348
|
+
return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ]
|
1349
|
+
|
1350
|
+
|
1351
|
+
def FormatTime(d):
|
1352
|
+
millis = round(d * 1000) % 1000
|
1353
|
+
return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis)
|
1354
|
+
|
1355
|
+
def ShardTests(tests, options):
|
1356
|
+
if options.shard_count < 2:
|
1357
|
+
return tests
|
1358
|
+
if options.shard_run < 1 or options.shard_run > options.shard_count:
|
1359
|
+
print "shard-run not a valid number, should be in [1:shard-count]"
|
1360
|
+
print "defaulting back to running all tests"
|
1361
|
+
return tests
|
1362
|
+
count = 0
|
1363
|
+
shard = []
|
1364
|
+
for test in tests:
|
1365
|
+
if count % options.shard_count == options.shard_run - 1:
|
1366
|
+
shard.append(test)
|
1367
|
+
count += 1
|
1368
|
+
return shard
|
1369
|
+
|
1370
|
+
def Main():
|
1371
|
+
parser = BuildOptions()
|
1372
|
+
(options, args) = parser.parse_args()
|
1373
|
+
if not ProcessOptions(options):
|
1374
|
+
parser.print_help()
|
1375
|
+
return 1
|
1376
|
+
|
1377
|
+
workspace = abspath(join(dirname(sys.argv[0]), '..'))
|
1378
|
+
suites = GetSuites(join(workspace, 'test'))
|
1379
|
+
repositories = [TestRepository(join(workspace, 'test', name)) for name in suites]
|
1380
|
+
repositories += [TestRepository(a) for a in options.suite]
|
1381
|
+
|
1382
|
+
root = LiteralTestSuite(repositories)
|
1383
|
+
if len(args) == 0:
|
1384
|
+
paths = [SplitPath(t) for t in BUILT_IN_TESTS]
|
1385
|
+
else:
|
1386
|
+
paths = [ ]
|
1387
|
+
for arg in args:
|
1388
|
+
path = SplitPath(arg)
|
1389
|
+
paths.append(path)
|
1390
|
+
|
1391
|
+
# Check for --valgrind option. If enabled, we overwrite the special
|
1392
|
+
# command flag with a command that uses the run-valgrind.py script.
|
1393
|
+
if options.valgrind:
|
1394
|
+
run_valgrind = join(workspace, "tools", "run-valgrind.py")
|
1395
|
+
options.special_command = "python -u " + run_valgrind + " @"
|
1396
|
+
|
1397
|
+
shell = abspath(options.shell)
|
1398
|
+
buildspace = dirname(shell)
|
1399
|
+
|
1400
|
+
context = Context(workspace, buildspace, VERBOSE,
|
1401
|
+
shell,
|
1402
|
+
options.timeout,
|
1403
|
+
GetSpecialCommandProcessor(options.special_command),
|
1404
|
+
options.suppress_dialogs,
|
1405
|
+
options.store_unexpected_output)
|
1406
|
+
# First build the required targets
|
1407
|
+
if not options.no_build:
|
1408
|
+
reqs = [ ]
|
1409
|
+
for path in paths:
|
1410
|
+
reqs += root.GetBuildRequirements(path, context)
|
1411
|
+
reqs = list(set(reqs))
|
1412
|
+
if len(reqs) > 0:
|
1413
|
+
if options.j != 1:
|
1414
|
+
options.scons_flags += ['-j', str(options.j)]
|
1415
|
+
if not BuildRequirements(context, reqs, options.mode, options.scons_flags):
|
1416
|
+
return 1
|
1417
|
+
|
1418
|
+
# Just return if we are only building the targets for running the tests.
|
1419
|
+
if options.build_only:
|
1420
|
+
return 0
|
1421
|
+
|
1422
|
+
# Get status for tests
|
1423
|
+
sections = [ ]
|
1424
|
+
defs = { }
|
1425
|
+
root.GetTestStatus(context, sections, defs)
|
1426
|
+
config = Configuration(sections, defs)
|
1427
|
+
|
1428
|
+
# List the tests
|
1429
|
+
all_cases = [ ]
|
1430
|
+
all_unused = [ ]
|
1431
|
+
unclassified_tests = [ ]
|
1432
|
+
globally_unused_rules = None
|
1433
|
+
for path in paths:
|
1434
|
+
for mode in options.mode:
|
1435
|
+
env = {
|
1436
|
+
'mode': mode,
|
1437
|
+
'system': utils.GuessOS(),
|
1438
|
+
'arch': options.arch,
|
1439
|
+
'simulator': options.simulator,
|
1440
|
+
'crankshaft': options.crankshaft
|
1441
|
+
}
|
1442
|
+
test_list = root.ListTests([], path, context, mode, [])
|
1443
|
+
unclassified_tests += test_list
|
1444
|
+
(cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env)
|
1445
|
+
if globally_unused_rules is None:
|
1446
|
+
globally_unused_rules = set(unused_rules)
|
1447
|
+
else:
|
1448
|
+
globally_unused_rules = globally_unused_rules.intersection(unused_rules)
|
1449
|
+
all_cases += ShardTests(cases, options)
|
1450
|
+
all_unused.append(unused_rules)
|
1451
|
+
|
1452
|
+
if options.cat:
|
1453
|
+
visited = set()
|
1454
|
+
for test in unclassified_tests:
|
1455
|
+
key = tuple(test.path)
|
1456
|
+
if key in visited:
|
1457
|
+
continue
|
1458
|
+
visited.add(key)
|
1459
|
+
print "--- begin source: %s ---" % test.GetLabel()
|
1460
|
+
source = test.GetSource().strip()
|
1461
|
+
print source
|
1462
|
+
print "--- end source: %s ---" % test.GetLabel()
|
1463
|
+
return 0
|
1464
|
+
|
1465
|
+
if options.warn_unused:
|
1466
|
+
for rule in globally_unused_rules:
|
1467
|
+
print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path])
|
1468
|
+
|
1469
|
+
if options.report:
|
1470
|
+
PrintReport(all_cases)
|
1471
|
+
|
1472
|
+
result = None
|
1473
|
+
def DoSkip(case):
|
1474
|
+
return SKIP in case.outcomes or SLOW in case.outcomes
|
1475
|
+
cases_to_run = [ c for c in all_cases if not DoSkip(c) ]
|
1476
|
+
if not options.isolates:
|
1477
|
+
cases_to_run = [c for c in cases_to_run if not c.TestsIsolates()]
|
1478
|
+
if len(cases_to_run) == 0:
|
1479
|
+
print "No tests to run."
|
1480
|
+
return 0
|
1481
|
+
else:
|
1482
|
+
try:
|
1483
|
+
start = time.time()
|
1484
|
+
if RunTestCases(cases_to_run, options.progress, options.j):
|
1485
|
+
result = 0
|
1486
|
+
else:
|
1487
|
+
result = 1
|
1488
|
+
duration = time.time() - start
|
1489
|
+
except KeyboardInterrupt:
|
1490
|
+
print "Interrupted"
|
1491
|
+
return 1
|
1492
|
+
|
1493
|
+
if options.time:
|
1494
|
+
# Write the times to stderr to make it easy to separate from the
|
1495
|
+
# test output.
|
1496
|
+
print
|
1497
|
+
sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration))
|
1498
|
+
timed_tests = [ t.case for t in cases_to_run if not t.case.duration is None ]
|
1499
|
+
timed_tests.sort(lambda a, b: a.CompareTime(b))
|
1500
|
+
index = 1
|
1501
|
+
for entry in timed_tests[:20]:
|
1502
|
+
t = FormatTime(entry.duration)
|
1503
|
+
sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel()))
|
1504
|
+
index += 1
|
1505
|
+
|
1506
|
+
return result
|
1507
|
+
|
1508
|
+
|
1509
|
+
if __name__ == '__main__':
|
1510
|
+
sys.exit(Main())
|