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

Remove fsanitize for ingen and inwer #221

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/sinol_make/commands/ingen/ingen_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_ingen(task_id, ingen_path=None):
return correct_ingen


def compile_ingen(ingen_path: str, args: argparse.Namespace, compilation_flags='default'):
def compile_ingen(ingen_path: str, args: argparse.Namespace, compilation_flags='default', use_fsanitize=False):
"""
Compiles ingen and returns path to compiled executable.
If ingen_path is shell script, then it will be returned.
Expand All @@ -57,7 +57,7 @@ def compile_ingen(ingen_path: str, args: argparse.Namespace, compilation_flags='

compilers = compiler.verify_compilers(args, [ingen_path])
ingen_exe, compile_log_path = compile.compile_file(ingen_path, package_util.get_executable(ingen_path),
compilers, compilation_flags, use_fsanitize=True,
compilers, compilation_flags, use_fsanitize=use_fsanitize,
additional_flags='-D_INGEN')

if ingen_exe is None:
Expand Down
4 changes: 2 additions & 2 deletions src/sinol_make/commands/inwer/inwer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def get_inwer_path(task_id: str, path=None) -> Union[str, None]:
return None


def compile_inwer(inwer_path: str, args: argparse.Namespace, compilation_flags='default'):
def compile_inwer(inwer_path: str, args: argparse.Namespace, compilation_flags='default', use_fsanitize=False):
"""
Compiles inwer and returns path to compiled executable and path to compile log.
"""
compilers = compiler.verify_compilers(args, [inwer_path])
inwer_exe, compile_log_path = compile.compile_file(inwer_path, package_util.get_executable(inwer_path), compilers,
compilation_flags, use_fsanitize=True,
compilation_flags, use_fsanitize=use_fsanitize,
additional_flags='-D_INWER')

if inwer_exe is None:
Expand Down
14 changes: 0 additions & 14 deletions tests/commands/gen/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,6 @@ def test_correct_solution_changed(create_package):
assert outputs[os.path.basename(output)] != sm_util.get_file_md5(output)


@pytest.mark.parametrize("create_package", [util.get_shell_ingen_pack_path()], indirect=True)
def test_fsanitize(create_package):
"""
Test if ingen is compiled with -fsanitize=address,undefined flags.
"""
if sm_util.is_macos_arm():
pytest.skip("-fsanitize=address,undefined is not supported on Apple Silicon")
for ingen in ["prog/geningen3.cpp", "prog/geningen4.cpp"]:
with pytest.raises(SystemExit) as e:
simple_run([ingen])
assert e.type == SystemExit
assert e.value.code == 1


@pytest.mark.parametrize("create_package", [util.get_bad_tests_package_path()], indirect=True)
def test_bad_tests(create_package, capsys):
"""
Expand Down
17 changes: 0 additions & 17 deletions tests/commands/inwer/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,3 @@ def test_no_output(capsys, create_package):
assert e.value.code == 0
out = capsys.readouterr().out
assert "No output" in out


@pytest.mark.parametrize("create_package", [util.get_inwer_package_path()], indirect=True)
def test_fsanitize(create_package):
"""
Test if inwer is compiled with -fsanitize=address,undefined.
"""
if sm_util.is_macos_arm():
pytest.skip("-fsanitize=address,undefined is not supported on Apple Silicon")
for inwer in ["prog/werinwer5.cpp", "prog/werinwer6.cpp"]:
parser = configure_parsers()
args = parser.parse_args(["inwer", inwer])
command = Command()
with pytest.raises(SystemExit) as e:
command.run(args)
assert e.type == SystemExit
assert e.value.code == 1
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ def _compile(args):
output = paths.get_executables_path(os.path.splitext(os.path.basename(file_path))[0] + ".e")
compile_log_path = paths.get_compilation_log_path(os.path.basename(file_path) + ".compile_log")
basename = os.path.basename(file_path)
use_fsanitize = fnmatch.fnmatch(basename, "*ingen*") or fnmatch.fnmatch(basename, "*inwer*")
try:
with open(compile_log_path, "w") as compile_log:
compile.compile(file_path, output, compile_log=compile_log, use_fsanitize=use_fsanitize)
compile.compile(file_path, output, compile_log=compile_log)
except CompilationError:
compile.print_compile_log(compile_log_path)
raise
Expand Down
Loading