コード例 #1
0
    def test_filters_blacklisted(self):
        project = create_project("-id-", base_path=self.temp_dir)
        create_file(project._project_file)
        uut = CollectProjectsTask(self.temp_dir)

        actual = uut.run(DataEntityLists([], ["-id-"]))

        assert_equals([], actual)
コード例 #2
0
    def test_finds_all_projects(self):
        p1 = create_project("p1", base_path=self.temp_dir)
        create_file(p1._project_file)
        p2 = create_project("p2", base_path=self.temp_dir)
        create_file(p2._project_file)
        uut = CollectProjectsTask(self.temp_dir)

        actual = uut.run(DataEntityLists([], []))

        assert_equals([p1, p2], actual)
コード例 #3
0
ファイル: configurations.py プロジェクト: zqcui/MUBench
 def tasks(self, config) -> List:
     collect_projects = CollectProjectsTask(config.data_path)
     collect_versions = CollectVersionsTask(config.development_mode)
     collect_misuses = CollectMisusesTask()
     calculator = stats.get_calculator(config.script)
     return [
         collect_projects, collect_versions, collect_misuses, calculator
     ]
コード例 #4
0
ファイル: configurations.py プロジェクト: zqcui/MUBench
 def tasks(self, config) -> List:
     collect_projects = CollectProjectsTask(config.data_path)
     collect_versions = CollectVersionsTask(config.development_mode)
     collect_misuses = CollectMisusesTask()
     project_check = ProjectCheckTask()
     version_check = VersionCheckTask()
     misuse_check = MisuseCheckTask(
         get_available_datasets(config.datasets_file_path),
         config.checkouts_path, config.data_path)
     return [
         collect_projects, project_check, collect_versions, version_check,
         collect_misuses, misuse_check
     ]
コード例 #5
0
ファイル: configurations.py プロジェクト: zqcui/MUBench
 def tasks(self, config) -> List:
     collect_projects = CollectProjectsTask(config.data_path)
     collect_versions = CollectVersionsTask(config.development_mode)
     collect_misuses = CollectMisusesTask()
     project_info = ProjectInfoTask(config.checkouts_path,
                                    config.compiles_path)
     version_info = VersionInfoTask(config.checkouts_path,
                                    config.compiles_path)
     misuse_info = MisuseInfoTask(config.checkouts_path,
                                  config.compiles_path)
     return [
         collect_projects, project_info, collect_versions, version_info,
         collect_misuses, misuse_info
     ]
コード例 #6
0
_INDEX_PATH = os.path.join(__MUBENCH_ROOT_PATH, "checkouts-xp", "index.csv")


class PrintIndexTask:
    def run(self, project: Project, version: ProjectVersion, misuse: Misuse):
        print("{}\t{}\t{}\t{}\t{}\t{}\t{}".format(
            project.id, version.version_id, misuse.misuse_id,
            ':'.join(version.source_dirs), misuse.location.file,
            misuse.location.method, "\t".join(misuse.apis)),
              file=open(_INDEX_PATH, "a"))


datasets = sys.argv[1:]

white_list = []
for dataset in datasets:
    white_list.extend(get_white_list(__MUBENCH_DATASETS_FILE, dataset.lower()))
initial_parameters = [DataEntityLists(white_list, [])]

runner = TaskRunner([
    CollectProjectsTask(__MUBENCH_DATA_PATH),
    CollectVersionsTask(False),
    CollectMisusesTask(),
    PrintIndexTask()
])

if os.path.exists(_INDEX_PATH):
    os.remove(_INDEX_PATH)

runner.run(*initial_parameters)
コード例 #7
0
ファイル: configurations.py プロジェクト: zqcui/MUBench
 def tasks(self, config) -> List:
     collect_projects = CollectProjectsTask(config.data_path)
     collect_versions = CollectVersionsTask(config.development_mode)
     checkout = CheckoutTask(config.checkouts_path, config.run_timestamp,
                             config.force_checkout, config.use_tmp_wrkdir)
     return [collect_projects, collect_versions, checkout]