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

Use the same command line parser as LPython and LFortran #66

Merged
merged 4 commits into from
Jan 14, 2024
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
63 changes: 21 additions & 42 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,49 +179,28 @@ RUN(NAME expr1.c LABELS gcc c wasm llvm NOFAST)
RUN(NAME expr2.c LABELS gcc c wasm llvm NOFAST)
RUN(NAME expr3.c FAIL LABELS gcc c wasm llvm NOFAST)

RUN(NAME switch_case_01.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME switch_case_01.cpp LABELS gcc llvm NOFAST)

# arrays
RUN(NAME array_01.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_02.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_03.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_04.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_05.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_06.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_07.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_08.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_09.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_10.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_11.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_12.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_13.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_14.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_15.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_16.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_17.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_18.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_19.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_20.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_21.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
RUN(NAME array_22.cpp LABELS gcc llvm NOFAST
EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above test cases are intact. Just the EXTRA_ARGS is removed.

RUN(NAME array_03.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_04.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_05.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_06.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_07.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_08.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_09.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_10.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_11.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_12.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_13.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_14.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_15.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_16.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_17.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_18.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_19.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_20.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_21.cpp LABELS gcc llvm NOFAST)
RUN(NAME array_22.cpp LABELS gcc llvm NOFAST)
23 changes: 11 additions & 12 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def is_included(backend):
fortran = is_included("fortran")
is_cumulative = is_included("cumulative")
wat = is_included("wat")
clang_extra_arg = test.get("extra_arg", "")
disable_main = is_included("disable_main")
pass_ = test.get("pass", None)
optimization_passes = ["flip_sign", "div_to_mul", "fma", "sign_from_value",
Expand All @@ -48,23 +47,23 @@ def is_included(backend):
run_test(
filename,
"ast",
"lc --show-ast {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
"lc --show-ast {infile} -o {outfile}",
filename,
update_reference, extra_args)

if asr:
run_test(
filename,
"asr",
"lc --show-asr --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
"lc --show-asr --no-color {infile} -o {outfile}",
filename,
update_reference, extra_args)

if asr_json:
run_test(
filename,
"asr_json",
"lc --show-asr --json --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
"lc --show-asr --json --no-color {infile} -o {outfile}",
filename,
update_reference, extra_args)

Expand All @@ -73,7 +72,7 @@ def is_included(backend):
if is_cumulative:
cmd += "--cumulative "
cmd += "--pass=" + pass_ + \
" --show-asr --no-color {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"'
" --show-asr --no-color {infile} -o {outfile}"
run_test(filename, "pass_{}".format(pass_), cmd,
filename, update_reference, extra_args)

Expand All @@ -84,34 +83,34 @@ def is_included(backend):
run_test(
filename,
"llvm",
"lc --no-color --show-llvm {infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
"lc --no-color --show-llvm {infile} -o {outfile}",
filename,
update_reference, extra_args)
if llvm_dbg:
run_test(
filename,
"llvm_dbg",
"lc --no-color --show-llvm -g --debug-with-line-column "
"{infile} -o {outfile}" + f' -extra-arg="{clang_extra_arg}"',
"{infile} -o {outfile}",
filename,
update_reference, extra_args)

if cpp:
run_test(filename, "cpp", "lc --no-color --show-cpp {infile}" + f' -extra-arg="{clang_extra_arg}"',
run_test(filename, "cpp", "lc --no-color --show-cpp {infile}",
filename, update_reference, extra_args)

if c:
if disable_main:
run_test(filename, "c", "lc --no-color --disable-main --show-c {infile}" + f' -extra-arg="{clang_extra_arg}"',
run_test(filename, "c", "lc --no-color --disable-main --show-c {infile}",
filename, update_reference, extra_args)
else:
run_test(filename, "c", "lc --no-color --show-c {infile}" + f' -extra-arg="{clang_extra_arg}"',
run_test(filename, "c", "lc --no-color --show-c {infile}",
filename, update_reference, extra_args)
if wat:
run_test(filename, "wat", "lc --no-color --show-wat {infile}" + f' -extra-arg="{clang_extra_arg}"',
run_test(filename, "wat", "lc --no-color --show-wat {infile}",
filename, update_reference, extra_args)
if fortran:
run_test(filename, "fortran", "lc --no-color --show-fortran {infile}" + f' -extra-arg="{clang_extra_arg}"',
run_test(filename, "fortran", "lc --no-color --show-fortran {infile}",
filename, update_reference, extra_args)

if __name__ == "__main__":
Expand Down
Loading
Loading