diff options
author | Yuheng Long <yuhenglong@google.com> | 2013-08-14 10:17:25 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-16 22:12:08 -0700 |
commit | ce860ea3fc65c488b9ea5e93efbf521dae9dc7dd (patch) | |
tree | 0b8a0793a9eacbba3caedb0f3c543e7ee338f618 /bestflags/testing_batch.py | |
parent | 25cdf79e17a73858ffa28db8a5b387210fea9e25 (diff) | |
download | toolchain-utils-ce860ea3fc65c488b9ea5e93efbf521dae9dc7dd.tar.gz |
Fixed the problems in task and steering.
BUG=None
TEST=unit testings for the pipeline stage, pipeline workers, generation,
steering, task, flag, hill climbing and genetic algorithm.
Change-Id: Ib34ef05518124b6ffa03f0c35795109e22581b89
Reviewed-on: https://gerrit-int.chromium.org/43002
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Yuheng Long <yuhenglong@google.com>
Tested-by: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags/testing_batch.py')
-rw-r--r-- | bestflags/testing_batch.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/bestflags/testing_batch.py b/bestflags/testing_batch.py index f44c4f66..97ea450a 100644 --- a/bestflags/testing_batch.py +++ b/bestflags/testing_batch.py @@ -104,7 +104,7 @@ def _GenerateNoFlagTask(): return set([Task(FlagSet([]))]) -def _GenerateRandomGATasks(specs, num_tasks, num_trials): +def GenerateRandomGATasks(specs, num_tasks, num_trials): """Generate a set of tasks for the Genetic Algorithm. Args: @@ -233,8 +233,14 @@ def _TestAlgorithm(cost_func, specs, generations, best_result): assert best_result == result -class FlagAlgorithms(unittest.TestCase): - """This class test the FlagSet class.""" +class MockAlgorithmsTest(unittest.TestCase): + """This class mock tests different steering algorithms. + + The steering algorithms are responsible for generating the next set of tasks + to run in each iteration. This class does a functional testing on the + algorithms. It mocks out the computation of the fitness function from the + build and test phases by letting the user define the fitness function. + """ def testBestHillClimb(self): """Test the best hill climb algorithm. @@ -279,7 +285,7 @@ class FlagAlgorithms(unittest.TestCase): def testGeneticAlgorithm(self): """Test the Genetic Algorithm. - Do a function testing here and see how well it scales. + Do a functional testing here and see how well it scales. """ # Initiate the build/test command and the log directory. @@ -295,8 +301,8 @@ class FlagAlgorithms(unittest.TestCase): specs, MUTATION_RATE) # Generate the initial generations. - generation_tasks = _GenerateRandomGATasks(specs, NUM_CHROMOSOMES, - NUM_TRIALS) + generation_tasks = GenerateRandomGATasks(specs, NUM_CHROMOSOMES, + NUM_TRIALS) generations = [GAGeneration(generation_tasks, set([]), 0)] # Test the algorithm. |