Skip to content

Commit

Permalink
Use absolute paths for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Aug 9, 2022
1 parent fd046aa commit d437119
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion run_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env python

import sys
sys.path.append("src/libasr")
import os

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__)))
sys.path.append(os.path.join(ROOT_DIR, "src", "libasr"))

from compiler_tester.tester import color, fg, log, run_test, style, tester_main


Expand Down
10 changes: 8 additions & 2 deletions src/libasr/compiler_tester/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
log.setLevel(level)


TESTER_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__)))
LIBASR_DIR = os.path.dirname(TESTER_DIR)
SRC_DIR = os.path.dirname(LIBASR_DIR)
ROOT_DIR = os.path.dirname(SRC_DIR)


class RunException(Exception):
pass

Expand Down Expand Up @@ -335,9 +341,9 @@ def tester_main(compiler, single_test):
no_llvm = args.no_llvm

# So that the tests find the `lpython` executable
os.environ["PATH"] = os.path.join(os.getcwd(), "src", "bin") \
os.environ["PATH"] = os.path.join(SRC_DIR, "bin") \
+ os.pathsep + os.environ["PATH"]
test_data = toml.load(open("tests/tests.toml"))
test_data = toml.load(open(os.path.join(ROOT_DIR, "tests", "tests.toml")))
if specific_test:
# some fuzzy comparison to get all seemingly fitting tests tested
specific = [test for test in test_data["test"]
Expand Down

0 comments on commit d437119

Please sign in to comment.