1 """Provides common functionality to the test scripts."""
5 from pathlib
import Path
7 def set_source(source
):
8 """Checks whether the source file exists and returns its path."""
9 if not Path(source
).is_file():
13 def set_executable(executable
):
14 """Checks whether a Flang executable has been set and returns its path."""
15 flang_fc1
= Path(executable
)
16 if not flang_fc1
.is_file():
21 """Sets a temporary directory or creates one if it doesn't exist."""
22 os
.makedirs(Path(tmp
), exist_ok
=True)
26 """Used in other functions."""
28 print(f
"{sys.argv[0]}: FAIL")
30 print(f
"{sys.argv[0]}: File not found: {file}")
34 """Verifies that 2 arguments have been passed."""
36 print(f
"Usage: {args[0]} <fortran-source> <flang-command>")
39 def check_args_long(args
):
40 """Verifies that 3 arguments have been passed."""
42 print(f
"Usage: {args[0]} <fortran-source> <temp-test-dir> <flang-command>")