v8/tools/unittests/testdata/testroot2/d8_mocked.py
Michael Achenbach 6c72df9ed0 Reland "[test] Add test runner system tests for flaky tests"
This is a reland of 96f5579669
Original change's description:
> [test] Add test runner system tests for flaky tests
>
> This uses a temporary file in the mocked d8 script to let d8 flip
> between FAIL and PASS on rerun.
>
> This adds a separate test root with dedicated test suite for testing
> flakes to no interfere with existing status file configs.
>
> NOTRY=true
>
> Bug: v8:6917
> Change-Id: Id43753650195fb74cceb2a3ee9014100cabad546
> Reviewed-on: https://chromium-review.googlesource.com/867917
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50621}

TBR=sergiyb@chromium.org
NOTRY=true

Bug: v8:6917
Change-Id: I4e7bca272dfd8778fbb8d012fcd6fd8406158e43
Reviewed-on: https://chromium-review.googlesource.com/868433
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50625}
2018-01-16 15:01:56 +00:00

30 lines
810 B
Python

# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Dummy d8 replacement for flaky tests.
"""
import os
import sys
PATH = os.path.dirname(os.path.abspath(__file__))
print ' '.join(sys.argv[1:])
# Test files ending in 'flakes' should first fail then pass. We store state in
# a file side by side with the executable. No clean-up required as all tests
# run in a temp test root. Restriction: Only one variant is supported for now.
for arg in sys.argv[1:]:
if arg.endswith('flakes'):
flake_state = os.path.join(PATH, arg)
if os.path.exists(flake_state):
sys.exit(0)
else:
with open(flake_state, 'w') as f:
f.write('something')
sys.exit(1)
sys.exit(0)