コード例 #1
0
    def load_correct_outputs(self):
        assert self._correct_outputs is None

        # Copy the buggy source into our current dir. We need to be in the same dir
        # as we compiled to run gcov, and if we try to keep the buggy version in
        # its own directory, we'll have to call chdir() over and over
        working_runnable = compile_working_version(self._project)
        
        # FIXME: make get_tests lazily get the tests
        test_lines = get_tests(self._project.test_file)
        self._correct_outputs = []
        for i, test in enumerate(test_lines):
            if i % 500 == 0:
                print("Running correct version on test {0}".format(i))

            expected_output = get_output(working_runnable + " " +  test, True)
            self._correct_outputs.append(expected_output)
コード例 #2
0
    def get_buggy_version_results(self):
        buggy_program = compile_buggy_version(self._project)

        test_lines = get_tests(self._project.test_file)

        passcount = 0
        run_to_result = {}
        for i, test in enumerate(test_lines):
            if i % 500 == 0:
                print("Running buggy version test {0}".format(i))

            prog_output = get_output(buggy_program + " " + test, True)

            passed = prog_output == self._correct_outputs[i]
            if passed:
                passcount += 1

            spectrum = gcov_helper.get_trace(self._project.main_src_file)
            gcov_helper.reset_gcov_counts(self._project.main_src_file)

            run_to_result[i] = RunResult(passed=passed, spectrum=spectrum)

        print("Passed {0}/{1}".format(passcount, len(test_lines)))
        return run_to_result
コード例 #3
0
def _run_gcov(filename):
    _ = get_output(["gcov", filename])
コード例 #4
0
def make_feature_file(spectra_file, out_feature_file):
    commandio.get_output(["feature-extractor/feature-extractor", spectra_file,
                          out_feature_file,
                          "pairwise"])
    assert os.path.exists(out_feature_file)