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