Debian Codegraph @

llvm/utils/lit/tests/Inputs/max-retries-per-test/no-allow-retries-test_retry_attempts/test.py

raw
1 # RUN: "%python" "%s" "%counter"
2
3 import sys
4 import os
5
6 counter_file = sys.argv[1]
7
8 # The first time the test is run, initialize the counter to 1.
9 if not os.path.exists(counter_file):
10 with open(counter_file, "w") as counter:
11 counter.write("1")
12
13 # Succeed if this is the fourth time we're being run.
14 with open(counter_file, "r") as counter:
15 num = int(counter.read())
16 if num == 4:
17 sys.exit(0)
18
19 # Otherwise, increment the counter and fail
20 with open(counter_file, "w") as counter:
21 counter.write(str(num + 1))
22 sys.exit(1)