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

fix(core): fix TestRunner #41

Merged
merged 11 commits into from
Nov 10, 2023
Merged
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: 3 additions & 1 deletion lib/core/src/test_runner.ri
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public struct TestRunner {
}
}
self.print_summary_tests();
process_exit(@as(int32, self.fail_tests));
if self.fail_tests > 0 {
process_exit(1);
}
}

func print_summary_tests(&self) {
Expand Down
4 changes: 0 additions & 4 deletions rivetc/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ def __init__(self, args):
self.checker = checker.Checker(self)
self.codegen = codegen.Codegen(self)

self.exit_code = 0

def import_modules(self):
for sf in self.parsed_files:
for decl in sf.decls:
Expand Down Expand Up @@ -147,8 +145,6 @@ def run(self):
self.codegen.gen_source_files(self.source_files)
if report.ERRORS > 0:
self.abort()
if self.exit_code != 0:
exit(self.exit_code)

def load_root_module(self):
if path.isdir(self.prefs.input):
Expand Down
5 changes: 4 additions & 1 deletion rivetc/src/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,11 @@ def gen_source_files(self, source_files):
self.comp.vlog("generating C output from RIR...")
CGen(self.comp).gen(self.out_rir)
if self.comp.prefs.build_mode == prefs.BuildMode.Test:
self.comp.exit_code = os.system(self.comp.prefs.mod_output)
exit_code = os.system(self.comp.prefs.mod_output)
os.remove(self.comp.prefs.mod_output)
# assert exit_code == 0
if exit_code != 0:
exit(1)

def gen_mod_attributes(self, mod_name, attributes):
mod_folder = os.path.join(prefs.RIVET_DIR, "obj", mod_name)
Expand Down
2 changes: 1 addition & 1 deletion rivetc/src/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def __init__(self, args: [str]):
self.build_rivet_dir()

if self.build_mode == BuildMode.Test:
self.mod_output = f"_tests_runner_"
self.mod_output = f"_tests_runner__{self.mod_name}_"
elif len(self.mod_output) == 0:
self.mod_output = self.mod_name
if self.target_os == OS.Windows and not self.mod_output.endswith(
Expand Down
Loading