Skip to content

Commit

Permalink
Enable ASR testing
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Jan 18, 2022
1 parent a130bd1 commit fbc3ff1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
16 changes: 1 addition & 15 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,8 @@ def main():
run_test("ast", "lpython --show-ast --no-color {infile} -o {outfile}",
filename, update_reference, extra_args)

if ast_f90:
if filename.endswith(".f"):
# Use fixed form
run_test("ast_f90", "lfortran --fixed-form --show-ast-f90 --no-color {infile}",
filename, update_reference, extra_args)
else:
# Use free form
run_test("ast_f90", "lfortran --show-ast-f90 --no-color {infile}",
filename, update_reference, extra_args)

if ast_openmp:
run_test("ast_openmp", "cpptranslate --show-ast-openmp {infile}",
filename, update_reference)

if asr:
run_test("asr", "lfortran --show-asr --no-color {infile} -o {outfile}",
run_test("asr", "lpython --show-asr --no-color {infile} -o {outfile}",
filename, update_reference, extra_args)

if asr_preprocess:
Expand Down
13 changes: 13 additions & 0 deletions tests/reference/asr-complex1-f26c460.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-complex1-f26c460",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/complex1.py",
"infile_hash": "36ca3f9dd10887171e408fcbe19a45ca6a91b39555376875bc8129df",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-complex1-f26c460.stdout",
"stdout_hash": "b17d1b657213adea98d3ced2e5c222b7239296d8b6212bd19eea72f1",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-complex1-f26c460.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 8 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 8 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.)}) test_complex [] [(= (Var 2 c) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (= (Var 2 c) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) (= (Var 2 c) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) (= (Var 2 c) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) (= (Var 2 c1) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (= (Var 2 c2) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) (= (Var 2 c3) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Var 2 c1) Eq (Var 2 c3) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) [])
13 changes: 13 additions & 0 deletions tests/reference/asr-doconcurrentloop_01-3fdc189.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-doconcurrentloop_01-3fdc189",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/doconcurrentloop_01.py",
"infile_hash": "c3efb3a1f583c1cc5f973f560369378d784bf5df6fcace9962624266",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-doconcurrentloop_01-3fdc189.stdout",
"stdout_hash": "686176dc44d627d0f8051f0cfad09481e44d51d5a2f995bb766a5dd4",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/asr-doconcurrentloop_01-3fdc189.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(TranslationUnit (SymbolTable 1 {main: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public Required .false.), b: (Variable 3 b Local () () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public Required .false.), c: (Variable 3 c Local () () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), nsize: (Variable 3 nsize Local () () Default (Integer 4 []) Source Public Required .false.), scalar: (Variable 3 scalar Local () () Default (Real 4 []) Source Public Required .false.)}) main [] [(= (Var 3 scalar) (ConstantInteger 10 (Integer 4 [])) ()) (= (Var 3 nsize) (ConstantInteger 1234 (Integer 4 [])) ()) (DoConcurrentLoop ((Var 3 i) (ConstantInteger 0 (Integer 4 [])) (Var 3 nsize) (ConstantInteger 1 (Integer 4 []))) [(= (ArrayRef 3 a [(() (Var 3 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) ()) (ConstantInteger 5 (Integer 4 [])) ()) (= (ArrayRef 3 b [(() (Var 3 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) ()) (ConstantInteger 5 (Integer 4 [])) ())]) (SubroutineCall 1 triad () [(Var 3 a) (Var 3 b) (Var 3 scalar) (Var 3 c)] ()) (Print () [(ConstantString "End Stream Triad" (Character 1 16 () []))])] Source Public Implementation () .false. .false.), triad: (Subroutine (SymbolTable 2 {N: (Variable 2 N Local () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 2 a InOut () () Default (Real 4 [(() ())]) Source Public Required .false.), b: (Variable 2 b InOut () () Default (Real 4 [(() ())]) Source Public Required .false.), c: (Variable 2 c InOut () () Default (Real 4 [(() ())]) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), scalar: (Variable 2 scalar In () () Default (Real 4 []) Source Public Required .false.)}) triad [(Var 2 a) (Var 2 b) (Var 2 scalar) (Var 2 c)] [(= (Var 2 N) (ConstantInteger 1234 (Integer 4 [])) ()) (DoConcurrentLoop ((Var 2 i) (ConstantInteger 0 (Integer 4 [])) (Var 2 N) (ConstantInteger 1 (Integer 4 []))) [(= (ArrayRef 2 c [(() (Var 2 i) ())] (Real 4 [(() ())]) ()) (BinOp (ArrayRef 2 a [(() (Var 2 i) ())] (Real 4 [(() ())]) ()) Add (BinOp (Var 2 scalar) Mul (ArrayRef 2 b [(() (Var 2 i) ())] (Real 4 [(() ())]) ()) (Real 4 []) () ()) (Real 4 [(() ())]) () ()) ())])] Source Public Implementation () .false. .false.)}) [])
2 changes: 2 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[[test]]
filename = "doconcurrentloop_01.py"
ast = true
asr = true

[[test]]
filename = "complex1.py"
ast = true
asr = true

0 comments on commit fbc3ff1

Please sign in to comment.