Skip to content

Commit

Permalink
- Added class for adapted picosat project
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Abelt committed Jan 30, 2024
1 parent 991bb76 commit e1ed49f
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions varats/varats/projects/c_projects/picosat.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,119 @@ def get_release_revisions(
return [(FullCommitHash(h), tag)
for h, tag in tagged_commits
if re.match(release_regex, tag)]


class PicoSATVaRA(VProject, ReleaseProviderHook):
"""Adapted version of picoSAT that has been refactored, such that it does
not require a field-sensitive analysis."""

NAME = 'picosat'
GROUP = 'c_projects'
DOMAIN = ProjectDomains.SOLVER

SOURCE = [
PaperConfigSpecificGit(
project_name="picosat-vara",
remote="https://github.com/se-sic/picoSAT-vara",
local="picosat",
refspec="origin/HEAD",
limit=None,
shallow=False
),
FeatureSource(),
HTTP(
local="example.cnf",
remote={
"1.0":
"https://github.com/se-sic/picoSAT-mirror/releases/"
"download/picoSAT-965/example.cnf"
}
),
HTTPUntar(
local="abw-N-bcsstk07.mtx-w44.cnf",
remote={
"1.0":
"https://github.com/se-sic/picoSAT-mirror/releases/"
"download/picoSAT-965/abw-N-bcsstk07.mtx-w44.cnf.tar.gz"
}
),
HTTPUntar(
local="traffic_kkb_unknown.cnf",
remote={
"1.0":
"https://github.com/se-sic/picoSAT-mirror/releases/"
"download/picoSAT-965/traffic_kkb_unknown.cnf.tar.gz"
}
),
HTTPUntar(
local="UNSAT_H_instances_childsnack_p11.hddl_1.cnf",
remote={
"1.0":
"https://github.com/se-sic/picoSAT-mirror/releases/"
"download/picoSAT-965/"
"UNSAT_H_instances_childsnack_p11.hddl_1.cnf.tar.gz"
}
),
HTTPUntar(
local="UNSAT_H_instances_childsnack_p12.hddl_1.cnf",
remote={
"1.0":
"https://github.com/se-sic/picoSAT-mirror/releases/"
"download/picoSAT-965/"
"UNSAT_H_instances_childsnack_p12.hddl_1.cnf.tar.gz"
}
),
]

WORKLOADS = PicoSAT.WORKLOADS

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(get_local_project_git_path(PicoSAT.NAME))
binary_map.specify_binary(
'picosat', BinaryType.EXECUTABLE, valid_exit_codes=[0, 10, 20]
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
picosat_source = local.path(self.source_of(self.primary_source))

c_compiler = bb.compiler.cc(self)
cxx_compiler = bb.compiler.cxx(self)

with local.cwd(picosat_source):
revisions_with_new_config_name = get_all_revisions_between(
"33c685e82213228726364980814f0183e435de78", "", ShortCommitHash
)
picosat_version = ShortCommitHash(self.version_of_primary)
if picosat_version in revisions_with_new_config_name:
config_script_name = "./configure.sh"
else:
config_script_name = "./configure"

with local.cwd(picosat_source):
with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
bb.watch(local[config_script_name])(["--trace", "--stats"])
bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

with local.cwd(picosat_source):
verify_binaries(self)

@classmethod
def get_release_revisions(
cls, release_type: ReleaseType
) -> tp.List[tp.Tuple[FullCommitHash, str]]:
release_regex = "^picoSAT-[0-9]+$"

tagged_commits = get_tagged_commits(cls.NAME)

return [(FullCommitHash(h), tag)
for h, tag in tagged_commits
if re.match(release_regex, tag)]

0 comments on commit e1ed49f

Please sign in to comment.