brintos

brintos / llvm-project-archived public Read only

0
0
Text · 572 B · 4227b89 Raw
24 lines · python
1# ALLOW_RETRIES: 82# RUN: "%python" "%s" "%counter"3 4import sys5import os6 7counter_file = sys.argv[1]8 9# The first time the test is run, initialize the counter to 1.10if not os.path.exists(counter_file):11    with open(counter_file, "w") as counter:12        counter.write("1")13 14# Succeed if this is the fourth time we're being run.15with open(counter_file, "r") as counter:16    num = int(counter.read())17    if num == 4:18        sys.exit(0)19 20# Otherwise, increment the counter and fail21with open(counter_file, "w") as counter:22    counter.write(str(num + 1))23    sys.exit(1)24