#!/usr/bin/python import tester import sys import os import time import glob t = tester.Tester(dueDate = time.mktime(time.strptime('2022-02-03 17:00', '%Y-%m-%d %H:%M'))) # required output string # (the b is a Python thing that says this is raw bytes and not Unicode) greeting = b'Hello, world!\n' # we will catch errors on these later try: t.copy('hello.c') except: pass # 20 pts if hello.c exists t.test(20, "test -e hello.c", timeLimit = 20) # 20 pts if hello.c compiles with all flags t.test(20, "gcc -Wall -pedantic -o hello hello.c", tester.Match(b''), 20) # 20 pts if hello.c compiles at all t.test(20, "gcc -o hello hello.c || echo compile failed", lambda s: s.find(b'compile failed') < 0, 20) # 20 pts if hello.c outputs the correct string t.test(20, "./hello", tester.Match(greeting), 20) # 20 pts if hello.c does not contain any forbidden characters t.test(20, "(grep -v '^#include' hello.c | grep '[lL1|oO0]') || true", tester.Match(b''), 20) print(t.report())