1########################################################################## 2# Copyright (c) 2016, ETH Zurich. 3# All rights reserved. 4# 5# This file is distributed under the terms in the attached LICENSE file. 6# If you do not find this file, copies can be found by writing to: 7# ETH Zurich D-INFK, Universitaetsstrasse 4, CH-8092 Zurich. Attn: Systems Group. 8########################################################################## 9 10import re 11import tests 12from common import TestCommon 13from results import PassFailResult 14import random 15 16class TomMathAbstract(TestCommon): 17 18 def get_finish_string(self): 19 return "DIGITS == 255...PASSED" 20 21@tests.add_test 22class TomMathMont(TomMathAbstract): 23 '''runs compiler-rt1 builins unit tests''' 24 name = "tommath-mont" 25 26 def get_modules(self, build, machine): 27 modules = super(TomMathMont, self).get_modules(build, machine) 28 modules.add_module("tommath/mont", [ int(random.random() * 100000) ]) 29 return modules 30 31 def process_data(self, testdir, rawiter): 32 # the test passed if no error occurred 33 passed = 3 34 for line in rawiter: 35 if "DIGITS == " in line: 36 passed += 1 37 return PassFailResult(passed == 255) 38