#!/usr/bin/env python3 """Verify Swedish exported tasks locally or one hard task per family in Docker.""" import argparse,sys from concurrent.futures import ThreadPoolExecutor import check_tasks def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--docker',action='store_true');args=parser.parse_args() rows=[t for t in check_tasks.tasks() if t['env'].startswith('swedish-')] if len(rows)!=324:raise SystemExit('Rebuild the 324 Swedish task exports first') if args.docker: seen=set();bad=0 for t in rows: key=(t['env'],t['family']) if key in seen or t['difficulty']!=3:continue seen.add(key);a,b,err=check_tasks.docker(t);ok=(a,b)==(0.,1.);bad+=not ok print(('ok' if ok else 'FAIL'),t['id'],a,b,err,flush=True) print(len(seen),'hard Swedish Docker checks,',bad,'failures');return int(bad>0 or len(seen)!=12) def run(t): result=check_tasks.local(t) if result!=(0.,1.):print('FAIL',t['id'],result,flush=True) return result==(0.,1.) with ThreadPoolExecutor(max_workers=4) as pool:results=list(pool.map(run,rows)) print(len(rows),'Swedish exports checked,',results.count(False),'failures');return int(not all(results)) if __name__=='__main__':sys.exit(main())