1# Copyright 2018 the V8 project authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""
6Dummy d8 replacement for flaky tests.
7"""
8
9# for py2/py3 compatibility
10from __future__ import print_function
11
12import os
13import sys
14
15PATH = os.path.dirname(os.path.abspath(__file__))
16
17print(' '.join(sys.argv[1:]))
18
19# Test files ending in 'flakes' should first fail then pass. We store state in
20# a file side by side with the executable. No clean-up required as all tests
21# run in a temp test root. Restriction: Only one variant is supported for now.
22for arg in sys.argv[1:]:
23  if arg.endswith('flakes'):
24    flake_state = os.path.join(PATH, arg)
25    if os.path.exists(flake_state):
26      sys.exit(0)
27    else:
28      with open(flake_state, 'w') as f:
29        f.write('something')
30      sys.exit(1)
31
32sys.exit(0)
33