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