From dc04b7b42a10fc389e70c93a52e6aa8259d0d94d Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Mar 2015 18:46:36 +0100 Subject: fixed point tests: return 1 in case of failure The fixed-point tests did not return any error code even upon failure. This lead to believing that they were passing. Signed-off-by: David Wagner --- test/test-fixed-point-parameter/Main.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/test-fixed-point-parameter/Main.py b/test/test-fixed-point-parameter/Main.py index 9a2eafc..65e1c8d 100755 --- a/test/test-fixed-point-parameter/Main.py +++ b/test/test-fixed-point-parameter/Main.py @@ -1,6 +1,6 @@ #!/usr/bin/python2.7 # -# Copyright (c) 2014, Intel Corporation +# Copyright (c) 2014-2015, Intel Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -83,29 +83,35 @@ class FixedPointTester(): Decimal(self._upperAllowedBound) + Decimal(littleValue) ] - def run(self): """ Runs the test suite for a given Qn.m number """ + + runSuccess = True + for value in self._shouldWork: print('Testing %s for %s' % (value, self._paramPath)) value, success = self.checkBounds(value) if not success: + runSuccess = False print('Bound ERROR for %s' % self._paramPath) continue value, success = self.checkSanity(value) if not success: + runSuccess = False print('Sanity ERROR %s' % self._paramPath) continue value, success = self.checkConsistency(value) if not success: + runSuccess = False print('Consistency ERROR %s' % self._paramPath) continue value, success = self.checkBijectivity(value) if not success: + runSuccess = False print('Bijectivity ERROR %s' % self._paramPath) continue @@ -113,8 +119,11 @@ class FixedPointTester(): print('Testing invalid value %s for %s' % (value, self._paramPath)) value, success = self.checkBounds(value) if success: + runSuccess = False print("ERROR: This test should have failed but it has not") + return runSuccess + def checkBounds(self, valueToSet): """ Checks if we are able to set valueToSet via the parameter-framework @@ -232,10 +241,13 @@ if __name__ == '__main__': # does not recognize the string as a path. configPath = './ParameterFrameworkConfiguration.xml' + success = True + with PfwClient(configPath) as pfw: for size in [8, 16, 32]: for integral in range(0, size): for fractional in range (0, size - integral): tester = FixedPointTester(pfw, size, integral, fractional) - tester.run() + success = tester.run() and success + exit(0 if success else 1) -- cgit v1.1