Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekly release #116

Merged
merged 31 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f3677a7
rshariffdeen Aug 8, 2023
deaa71f
Add a type hint for the run_repair command
Marti2203 Aug 8, 2023
f1f7d15
Add AlphaRepair (#100)
thanhlecongg Aug 8, 2023
7613ac7
Updae docs
Marti2203 Aug 8, 2023
175f08d
add new benchmark: aprcompvulnjava
rshariffdeen Aug 8, 2023
53f392a
compress depednecies into one
rshariffdeen Aug 8, 2023
b614686
explicitly specify test cases for arja/arja-e when no passing test is…
rshariffdeen Aug 9, 2023
b89daf5
Ensure that the thread pool can be big
Marti2203 Aug 10, 2023
bfed491
Include the copying of the correct submissions in the refactory bench…
Marti2203 Aug 10, 2023
9f88b4a
Update refactory reference
Marti2203 Aug 10, 2023
cb7263c
FuzzRepair: fix code in copying artifacts
yuntongzhang Aug 10, 2023
181c91c
Parallel mode: remove default python thread number limit
yuntongzhang Aug 10, 2023
bd18111
Remove duplicated code
yuntongzhang Aug 10, 2023
874b0c2
Add t^C Education benchmark reference
Marti2203 Aug 10, 2023
47934a2
Nag the user if the image file is incorrect
Marti2203 Aug 10, 2023
b35950e
fix driver: use sudo to build docker image
rshariffdeen Aug 10, 2023
99034a7
Update the python education benchmark
Marti2203 Aug 10, 2023
511a2d0
Executor logic was not correct
Marti2203 Aug 10, 2023
a26f1b4
add new benchmark aprcompfuncc
rshariffdeen Aug 10, 2023
a343345
Increase container api timeouts
yuntongzhang Aug 11, 2023
3c8a245
Give more time to threads in parallel mode
yuntongzhang Aug 11, 2023
8a793c6
Update references to submodules
Marti2203 Aug 11, 2023
9ee58c3
Update 2 benchmark references
Marti2203 Aug 11, 2023
4768581
Add SelfAPR (#103)
thanhlecongg Aug 11, 2023
40f0c3c
add new benchmark aprcompfuncjava demo
rshariffdeen Aug 14, 2023
65b33ff
fix bug: update correct target dir
rshariffdeen Aug 14, 2023
562e53a
Update ITSP reference, Verifix driver,
Marti2203 Aug 14, 2023
1d0a189
Update submodule references
Marti2203 Aug 14, 2023
c8a6647
Add C education benchmark and update ITSP again
Marti2203 Aug 14, 2023
e188e9a
update references
Marti2203 Aug 14, 2023
ae527f4
Add RewardRepair (#104)
thanhlecongg Aug 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,18 @@
[submodule "benchmark/aprcompaijs"]
path = benchmark/aprcompaijs
url = https://github.com/RepairComp/autocodejs.git
[submodule "benchmark/aprcompvulnjava"]
path = benchmark/aprcompvulnjava
url = https://github.com/apR-Comp/vulnerabilities-java
[submodule "benchmark/aprcompedupython"]
path = benchmark/aprcompedupython
url = https://github.com/APR-Comp/education-python-benchmark.git
[submodule "benchmark/aprcompfuncc"]
path = benchmark/aprcompfuncc
url = https://github.com/APR-Comp/functional-c
[submodule "benchmark/aprcompfuncjava"]
path = benchmark/aprcompfuncjava
url = https://github.com/apr-comp/functional-java
[submodule "benchmark/aprcompeduc"]
path = benchmark/aprcompeduc
url = https://github.com/APR-Comp/education-c-benchmark.git
6 changes: 5 additions & 1 deletion app/core/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def build_image(dockerfile_path: str, image_name: str):
emitter.build("\t\t[docker-api] {}".format(line_stream))
if "Successfully built" in line["stream"]:
id = line["stream"].split(" ")[-1]
if id is None:
utilities.error_exit(
"[error] Image was not build successfully. Please check whether the file builds outside of Cerberus"
)
return id
except docker.errors.BuildError as ex: # type: ignore
emitter.error(ex)
Expand Down Expand Up @@ -426,7 +430,7 @@ def stop_container(container_id: str):
emitter.normal("\t\t\t[framework] stopping docker container")
try:
container = client.containers.get(container_id)
container.stop(timeout=20) # type: ignore
container.stop(timeout=120) # type: ignore
except docker.errors.APIError as exp: # type: ignore
emitter.warning(exp)
emitter.warning(
Expand Down
1 change: 1 addition & 0 deletions app/core/task/repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def repair_wrapped(
# give 5 min grace period for threads to finish
wait_time = wait_time + 60.0 * 5
tool_thread.join(wait_time)

if tool_thread.is_alive():
emitter.highlight(
"\t\t\t[framework] {}: thread is not done, setting event to kill thread.".format(
Expand Down
4 changes: 4 additions & 0 deletions app/drivers/benchmarks/AbstractBenchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class AbstractBenchmark(AbstractDriver):
key_build_system = definitions.KEY_BUILD_SYSTEM
key_fail_mod_dir = definitions.KEY_FAILING_MODULE_DIRECTORY
key_test_all_cmd = definitions.KEY_TEST_ALL_CMD
key_dir_class = definitions.KEY_CLASS_DIRECTORY
key_dir_source = definitions.KEY_SOURCE_DIRECTORY
key_dir_tests = definitions.KEY_TEST_DIRECTORY
key_dir_test_class = definitions.KEY_TEST_CLASS_DIRECTORY
key_subject = definitions.KEY_SUBJECT
has_standard_name: bool = False

Expand Down
82 changes: 82 additions & 0 deletions app/drivers/benchmarks/c/APRCompEduC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import os
from datetime import datetime

from app.drivers.benchmarks.AbstractBenchmark import AbstractBenchmark


class APRCompEduC(AbstractBenchmark):
def __init__(self):
self.name = os.path.basename(__file__)[:-3].lower()
super(APRCompEduC, self).__init__()

def setup_experiment(self, bug_index, container_id, test_all):
is_error = super(APRCompEduC, self).setup_experiment(
bug_index, container_id, test_all
)
return is_error

def deploy(self, bug_index, container_id):
self.emit_normal("downloading experiment subject")
self.run_command(
container_id, "cp -rf {} {}/src".format(self.dir_setup, self.dir_expr)
)
return True

def config(self, bug_index, container_id):
self.emit_normal("configuring experiment subject")
return True

def build(self, bug_index, container_id):
self.emit_normal("building experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_build_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-build.log"
)
time = datetime.now()
command_str = "bash build_subject"

status = self.run_command(
container_id, command_str, self.log_build_path, self.dir_setup
)
self.emit_debug(
"setup took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def test(self, bug_index, container_id):
self.emit_normal("testing experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_test_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-test.log"
)
time = datetime.now()
failing_test_list = experiment_item[self.key_failing_tests]
command_str = f"bash run_test {failing_test_list[0]}"
status = self.run_command(
container_id, command_str, self.log_test_path, self.dir_setup
)
self.emit_debug(
" Test took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status != 0

def verify(self, bug_index, container_id):
self.emit_normal("verify dev patch and test-oracle")
return True

def transform(self, bug_index, container_id):
self.emit_normal("transform fix-file")
return True

def clean(self, exp_dir_path, container_id):
self.emit_normal("[framework] removing experiment subject")
command_str = "rm -rf " + exp_dir_path
self.run_command(container_id, command_str)
return

def save_artifacts(self, dir_info, container_id):
self.list_artifact_dirs = [] # path should be relative to experiment directory
self.list_artifact_files = [] # path should be relative to experiment directory
super(APRCompEduC, self).save_artifacts(dir_info, container_id)
172 changes: 172 additions & 0 deletions app/drivers/benchmarks/c/APRCompFuncC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import os
from datetime import datetime

from app.drivers.benchmarks.AbstractBenchmark import AbstractBenchmark


class APRCompFuncC(AbstractBenchmark):
def __init__(self):
self.name = os.path.basename(__file__)[:-3].lower()
super(APRCompFuncC, self).__init__()

def setup_experiment(self, bug_index, container_id, test_all):
if not container_id:
self.error_exit(
"unimplemented functionality: this benchmark only runs on docker"
)

is_error = True
if self.install_deps(bug_index, container_id):
is_error = super(APRCompFuncC, self).setup_experiment(
bug_index, container_id, test_all
)
if not is_error:
if self.verify(bug_index, container_id):
self.emit_success("verified successfully")
if self.transform(bug_index, container_id):
self.emit_success("transformation successful")
else:
self.emit_error("transformation failed")
is_error = True
else:
self.emit_error("verification failed")
is_error = True
return is_error

def install_deps(self, bug_index, container_id):
self.emit_normal("installing experiment dependencies")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_deps_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-deps.log"
)
time = datetime.now()
command_str = "bash install_deps"
status = self.run_command(
container_id, command_str, self.log_deps_path, self.dir_setup
)
self.emit_debug(
"installing dependencies took {} second(s)".format(
(datetime.now() - time).total_seconds()
)
)
return status == 0

def deploy(self, bug_index, container_id):
self.emit_normal("downloading experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_deploy_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-deploy.log"
)
time = datetime.now()
command_str = "bash setup_subject"
status = self.run_command(
container_id, command_str, self.log_deploy_path, self.dir_setup
)
self.emit_debug(
"setup took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def config(self, bug_index, container_id):
self.emit_normal("configuring experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_config_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-config.log"
)
time = datetime.now()
command_str = "bash config_subject"
status = self.run_command(
container_id, command_str, self.log_config_path, self.dir_setup
)
self.emit_debug(
"config took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def build(self, bug_index, container_id):
self.emit_normal("building experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_build_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-build.log"
)
time = datetime.now()
command_str = "bash build_subject"

status = self.run_command(
container_id, command_str, self.log_build_path, self.dir_setup
)
self.emit_debug(
"build took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def test(self, bug_index, container_id):
self.emit_normal("testing experiment subject")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_test_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-test.log"
)
time = datetime.now()
failing_test_list = experiment_item[self.key_failing_tests]
command_str = f"bash run_test {failing_test_list[0]}"
status = self.run_command(
container_id, command_str, self.log_test_path, self.dir_setup
)
self.emit_debug(
"test took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status != 0

def verify(self, bug_index, container_id):
self.emit_normal("verify dev patch and test-oracle")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_test_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-verify.log"
)
time = datetime.now()
failing_test_list = experiment_item[self.key_failing_tests]
command_str = f"bash verify_dev {failing_test_list[0]}"
status = self.run_command(
container_id, command_str, self.log_test_path, self.dir_setup
)

self.emit_debug(
"verify took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def transform(self, bug_index, container_id):
self.emit_normal("transforming source code")
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_test_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-transform.log"
)
time = datetime.now()
command_str = "echo 'transformation complete'"
status = self.run_command(
container_id, command_str, self.log_test_path, self.dir_setup
)
self.emit_debug(
"transform took {} second(s)".format(
(datetime.now() - time).total_seconds()
)
)
return status == 0

def clean(self, exp_dir_path, container_id):
self.emit_normal("removing experiment subject")
command_str = "rm -rf " + exp_dir_path
self.run_command(container_id, command_str)
return

def save_artifacts(self, dir_info, container_id):
self.list_artifact_dirs = [] # path should be relative to experiment directory
self.list_artifact_files = [] # path should be relative to experiment directory
super(APRCompFuncC, self).save_artifacts(dir_info, container_id)
4 changes: 2 additions & 2 deletions app/drivers/benchmarks/c/APRCompVulnC.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def build(self, bug_index, container_id):
container_id, command_str, self.log_build_path, self.dir_setup
)
self.emit_debug(
"setup took {} second(s)".format((datetime.now() - time).total_seconds())
"build took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

Expand All @@ -117,7 +117,7 @@ def test(self, bug_index, container_id):
container_id, command_str, self.log_test_path, self.dir_setup
)
self.emit_debug(
" Test took {} second(s)".format((datetime.now() - time).total_seconds())
"test took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status != 0

Expand Down
36 changes: 34 additions & 2 deletions app/drivers/benchmarks/c/ITSP.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from datetime import datetime

from app.drivers.benchmarks.AbstractBenchmark import AbstractBenchmark

Expand All @@ -14,6 +15,9 @@ def setup_experiment(self, bug_index, container_id, test_all):

def deploy(self, bug_index, container_id):
self.emit_normal("downloading experiment subject")
self.run_command(
container_id, "cp -rf {} {}/src".format(self.dir_setup, self.dir_expr)
)
return True

def config(self, bug_index, container_id):
Expand All @@ -22,11 +26,39 @@ def config(self, bug_index, container_id):

def build(self, bug_index, container_id):
self.emit_normal("building experiment subject")
return True
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_build_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-build.log"
)
time = datetime.now()
command_str = "bash build_subject"

status = self.run_command(
container_id, command_str, self.log_build_path, self.dir_setup
)
self.emit_debug(
"setup took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status == 0

def test(self, bug_index, container_id):
self.emit_normal("testing experiment subject")
return True
experiment_item = self.experiment_subjects[bug_index - 1]
bug_id = str(experiment_item[self.key_bug_id])
self.log_test_path = (
self.dir_logs + "/" + self.name + "-" + bug_id + "-test.log"
)
time = datetime.now()
failing_test_list = experiment_item[self.key_failing_tests]
command_str = f"bash run_test {failing_test_list[0]}"
status = self.run_command(
container_id, command_str, self.log_test_path, self.dir_setup
)
self.emit_debug(
" Test took {} second(s)".format((datetime.now() - time).total_seconds())
)
return status != 0

def verify(self, bug_index, container_id):
self.emit_normal("verify dev patch and test-oracle")
Expand Down
Loading