From 3510f7228fef50cf96a00a217dd17975072d5289 Mon Sep 17 00:00:00 2001 From: Kishan-Ved Date: Tue, 2 Jan 2024 15:46:38 +0530 Subject: [PATCH 1/7] fixed broken test in integration_tests elemental_01 --- integration_tests/elemental_01.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/integration_tests/elemental_01.py b/integration_tests/elemental_01.py index 4925fc6165..22d2f03ee9 100644 --- a/integration_tests/elemental_01.py +++ b/integration_tests/elemental_01.py @@ -9,17 +9,17 @@ def verify1d(array: f32[:], result: f32[:], size: i32): for i in range(size): assert abs(sin(sin(array[i])) - result[i]) <= eps -def verifynd(array: f64[:, :, :], result: f64[:, :, :], size1: i32, size2: i32, size3: i32): +def verifynd(array: f32[:, :, :], result: f32[:, :, :], size1: i32, size2: i32, size3: i32): i: i32 j: i32 k: i32 - eps: f64 - eps = 1e-12 + eps: f32 + eps = f32(1e-6) for i in range(size1): for j in range(size2): for k in range(size3): - assert abs(sin(array[i, j, k])**2.0 - result[i, j, k]) <= eps + assert abs(sin(array[i, j, k])**f32(2) - result[i, j, k]) <= eps def verify2d(array: f64[:, :], result: f64[:, :], size1: i32, size2: i32): i: i32 @@ -101,17 +101,17 @@ def elemental_sin(): sin1d = sin(sin(array1d)) - verify1d(array1d, sin1d, 256) + verify1d(array1d, sin1d, 256) # working fine - arraynd: f64[256, 64, 16] = empty((256, 64, 16), dtype=float64) - sinnd: f64[256, 64, 16] = empty((256, 64, 16), dtype=float64) + arraynd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) + sinnd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) for i in range(256): for j in range(64): for k in range(16): - arraynd[i, j, k] = float(i + j + k) + arraynd[i, j, k] = f32(i + j + k) - sinnd = sin(arraynd)**2.0 + sinnd = sin(arraynd)**f32(2) verifynd(arraynd, sinnd, 256, 64, 16) From c6ae1a7f501b2cd250deabebc2d3bb27d3a65094 Mon Sep 17 00:00:00 2001 From: Kishan-Ved Date: Tue, 2 Jan 2024 15:47:44 +0530 Subject: [PATCH 2/7] fixed broken test in integration_tests elemental_01 --- integration_tests/elemental_01.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/elemental_01.py b/integration_tests/elemental_01.py index 22d2f03ee9..668fa59a45 100644 --- a/integration_tests/elemental_01.py +++ b/integration_tests/elemental_01.py @@ -101,7 +101,7 @@ def elemental_sin(): sin1d = sin(sin(array1d)) - verify1d(array1d, sin1d, 256) # working fine + verify1d(array1d, sin1d, 256) arraynd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) sinnd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) From e95ab2dc50cc13d2c52e1b217e1fb3bf2880741b Mon Sep 17 00:00:00 2001 From: Kishan-Ved Date: Fri, 5 Jan 2024 13:45:38 +0530 Subject: [PATCH 3/7] fixed memory segfault --- integration_tests/elemental_01.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/integration_tests/elemental_01.py b/integration_tests/elemental_01.py index 668fa59a45..0a2787c7ed 100644 --- a/integration_tests/elemental_01.py +++ b/integration_tests/elemental_01.py @@ -9,17 +9,17 @@ def verify1d(array: f32[:], result: f32[:], size: i32): for i in range(size): assert abs(sin(sin(array[i])) - result[i]) <= eps -def verifynd(array: f32[:, :, :], result: f32[:, :, :], size1: i32, size2: i32, size3: i32): +def verifynd(array: f64[:, :, :], result: f64[:, :, :], size1: i32, size2: i32, size3: i32): i: i32 j: i32 k: i32 - eps: f32 - eps = f32(1e-6) + eps: f64 + eps = 1e-12 for i in range(size1): for j in range(size2): for k in range(size3): - assert abs(sin(array[i, j, k])**f32(2) - result[i, j, k]) <= eps + assert abs(sin(array[i, j, k])**2.0 - result[i, j, k]) <= eps def verify2d(array: f64[:, :], result: f64[:, :], size1: i32, size2: i32): i: i32 @@ -103,17 +103,17 @@ def elemental_sin(): verify1d(array1d, sin1d, 256) - arraynd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) - sinnd: f32[256, 64, 16] = empty((256, 64, 16), dtype=float32) + arraynd: f64[200, 64, 16] = empty((200, 64, 16), dtype=float64) + sinnd: f64[200, 64, 16] = empty((200, 64, 16), dtype=float64) - for i in range(256): + for i in range(200): for j in range(64): for k in range(16): - arraynd[i, j, k] = f32(i + j + k) + arraynd[i, j, k] = float(i + j + k) - sinnd = sin(arraynd)**f32(2) + sinnd = sin(arraynd)**2.0 - verifynd(arraynd, sinnd, 256, 64, 16) + verifynd(arraynd, sinnd, 200, 64, 16) def elemental_cos(): i: i32 @@ -162,4 +162,4 @@ def elemental_trig_identity(): elemental_cos() elemental_trig_identity() elemental_sum() -elemental_mul() +elemental_mul() \ No newline at end of file From 822ad8c31f7be12d3f4b589fb93213a6c5ef2075 Mon Sep 17 00:00:00 2001 From: Kishan-Ved Date: Fri, 5 Jan 2024 20:21:57 +0530 Subject: [PATCH 4/7] updated reference tests --- expr | Bin 0 -> 16128 bytes tests/reference/asr-elemental_01-b58df26.json | 4 ++-- .../reference/asr-elemental_01-b58df26.stdout | 22 +++++++++--------- .../run_dbg-test_assert_01-2f34744.json | 4 ++-- .../run_dbg-test_assert_01-2f34744.stderr | 9 ++----- .../run_dbg-test_assert_02-c6de25a.json | 4 ++-- .../run_dbg-test_assert_02-c6de25a.stderr | 9 ++----- .../run_dbg-test_assert_03-bd7b7dd.json | 4 ++-- .../run_dbg-test_assert_03-bd7b7dd.stderr | 13 ++--------- .../run_dbg-test_quit_01-30889cc.json | 4 ++-- .../run_dbg-test_quit_01-30889cc.stderr | 9 ++----- .../run_dbg-test_raise_01-dfd86ca.json | 4 ++-- .../run_dbg-test_raise_01-dfd86ca.stderr | 9 ++----- 13 files changed, 33 insertions(+), 62 deletions(-) create mode 100755 expr diff --git a/expr b/expr new file mode 100755 index 0000000000000000000000000000000000000000..82c85f86ee06f834c48d07461952d53d67e24312 GIT binary patch literal 16128 zcmeHOZ)_Y#6`woXm}!wr(A$iH{FUZ#~AT-fM}P%Oci|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Pju!1Pf0r7@ z?Y>2N_)!%T*T2aXz5e~Z;`R@kD^1}es_gF#@(15jrOf9EUK^$S5|#gzWC{m)fA4_T ze+NBw$hT)9dI>*87}Wb$GOy>XS6t1#-Q7jaN~w^WD|kU{@^y)u7B>aX>#C+1&(Ottpc>eof-XN`!zpFJ#L zH9wc7{zD=-9$t}VtG)H~?B!Qd|6%XCVtx@a)z)oCAt2TG&A=;c?8D=dhpQ^(BO$v> z`e_nR)BQ*OPX_p5;Nx%=a{SpUhx*aD;QJNx7VxV;Ke*0#g8T&QJq^6V#y`14te-vBffqw0$(i-SAdVh_)${q!Nu!RAI2y3w}pyN63_c-&?6)=i-y#3O z_(b7`xEjYf`EMfsD}cv-1@+eeuaJ%(T7iGePf%V1esvU{B7y5j9Lm^En`*&7360^L z?iiy2h>}wt8BsH0Xudz zo5ixd5?-8ezk@twLa3$5f@2H=I<|{roP&KCradmyqUD(CXtAu0+t#>gJCi zIk_xRU3>akaYRb>F{3ml)a+yts&LV<-IAlGUCLR-Wr7Z6wwX83fO6w`N2oZmgbG=8 z)Pjs-PQVdICMa3*M5*Q&jm5DnIAO^(bqA$u!Fi~`DC9EGCOpq7L{_M9HQ+9fDi`8^ zNZ~vVZW-{5a#Mnyr;I$0qhhJcdBhLE59dy7zmx146)5v3o>wu~0U5vj5ZN;}vmzni zUzx_|vEQEO1B?nQ5(e#YpV1wddvW`De#*%8(=^eW@3C70GB`J7d!D~C^869oh;ior z^E@&K9Cn%QFHi#+dHxG3GNBKDIsyXDE!m#ulZ^Zf;`Xy1<4Lf`xhl&%UuE1%l?B_+ zZJ34(Hks{t{>;ez=lX;F|2En0A%{F4XVi#Cdz`Ze?VkeSK1eF&h@e` TUM|(_i}+xIv?^c_5XC Date: Fri, 5 Jan 2024 20:32:11 +0530 Subject: [PATCH 5/7] commit --- tests/reference/run_dbg-test_assert_01-2f34744.json | 4 ++-- .../reference/run_dbg-test_assert_01-2f34744.stderr | 9 +++++++-- tests/reference/run_dbg-test_assert_02-c6de25a.json | 4 ++-- .../reference/run_dbg-test_assert_02-c6de25a.stderr | 9 +++++++-- tests/reference/run_dbg-test_assert_03-bd7b7dd.json | 4 ++-- .../reference/run_dbg-test_assert_03-bd7b7dd.stderr | 13 +++++++++++-- tests/reference/run_dbg-test_quit_01-30889cc.json | 4 ++-- tests/reference/run_dbg-test_quit_01-30889cc.stderr | 9 +++++++-- tests/reference/run_dbg-test_raise_01-dfd86ca.json | 4 ++-- .../reference/run_dbg-test_raise_01-dfd86ca.stderr | 9 +++++++-- 10 files changed, 49 insertions(+), 20 deletions(-) diff --git a/tests/reference/run_dbg-test_assert_01-2f34744.json b/tests/reference/run_dbg-test_assert_01-2f34744.json index 6532050ae1..f8ac5ccbe9 100644 --- a/tests/reference/run_dbg-test_assert_01-2f34744.json +++ b/tests/reference/run_dbg-test_assert_01-2f34744.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "run_dbg-test_assert_01-2f34744.stderr", - "stderr_hash": "b98857bfa7103401fe36c73b3ae82c8df55cc695173def2f456b5af0", - "returncode": 0 + "stderr_hash": "4811af471c73572b285e9ea01c8689abdd3cb32c717b3cd4876d2669", + "returncode": 1 } \ No newline at end of file diff --git a/tests/reference/run_dbg-test_assert_01-2f34744.stderr b/tests/reference/run_dbg-test_assert_01-2f34744.stderr index 43161a4a47..a7dc14d623 100644 --- a/tests/reference/run_dbg-test_assert_01-2f34744.stderr +++ b/tests/reference/run_dbg-test_assert_01-2f34744.stderr @@ -1,2 +1,7 @@ -sh: 1: llvm-dwarfdump: not found -Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. + File "tests/runtime_errors/test_assert_01.py", line 1 + def test(): + File "tests/runtime_errors/test_assert_01.py", line 4 + test() + File "tests/runtime_errors/test_assert_01.py", line 2 + assert False +AssertionError diff --git a/tests/reference/run_dbg-test_assert_02-c6de25a.json b/tests/reference/run_dbg-test_assert_02-c6de25a.json index a5af806f4a..19b16179f5 100644 --- a/tests/reference/run_dbg-test_assert_02-c6de25a.json +++ b/tests/reference/run_dbg-test_assert_02-c6de25a.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "run_dbg-test_assert_02-c6de25a.stderr", - "stderr_hash": "b98857bfa7103401fe36c73b3ae82c8df55cc695173def2f456b5af0", - "returncode": 0 + "stderr_hash": "d5bfce55992e8d0630849442ee1f9b32864c64c328917c29fafc9424", + "returncode": 1 } \ No newline at end of file diff --git a/tests/reference/run_dbg-test_assert_02-c6de25a.stderr b/tests/reference/run_dbg-test_assert_02-c6de25a.stderr index 43161a4a47..0b837dc18e 100644 --- a/tests/reference/run_dbg-test_assert_02-c6de25a.stderr +++ b/tests/reference/run_dbg-test_assert_02-c6de25a.stderr @@ -1,2 +1,7 @@ -sh: 1: llvm-dwarfdump: not found -Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. + File "tests/runtime_errors/test_assert_02.py", line 1 + def test(): + File "tests/runtime_errors/test_assert_02.py", line 4 + test() + File "tests/runtime_errors/test_assert_02.py", line 2 + assert 1 != 1, "One is equal to one." +AssertionError: One is equal to one. diff --git a/tests/reference/run_dbg-test_assert_03-bd7b7dd.json b/tests/reference/run_dbg-test_assert_03-bd7b7dd.json index bae6b9c108..f771107475 100644 --- a/tests/reference/run_dbg-test_assert_03-bd7b7dd.json +++ b/tests/reference/run_dbg-test_assert_03-bd7b7dd.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "run_dbg-test_assert_03-bd7b7dd.stderr", - "stderr_hash": "b98857bfa7103401fe36c73b3ae82c8df55cc695173def2f456b5af0", - "returncode": 0 + "stderr_hash": "cae7dd955478787917e9dbb0bc1f63631317b13da1d892c3ebab9097", + "returncode": 1 } \ No newline at end of file diff --git a/tests/reference/run_dbg-test_assert_03-bd7b7dd.stderr b/tests/reference/run_dbg-test_assert_03-bd7b7dd.stderr index 43161a4a47..65f2444ba9 100644 --- a/tests/reference/run_dbg-test_assert_03-bd7b7dd.stderr +++ b/tests/reference/run_dbg-test_assert_03-bd7b7dd.stderr @@ -1,2 +1,11 @@ -sh: 1: llvm-dwarfdump: not found -Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. + File "tests/runtime_errors/test_assert_03.py", line 1 + def f(): + File "tests/runtime_errors/test_assert_03.py", line 10 + main() + File "tests/runtime_errors/test_assert_03.py", line 8 + f() + File "tests/runtime_errors/test_assert_03.py", line 2 + g() + File "tests/runtime_errors/test_assert_03.py", line 5 + assert False +AssertionError diff --git a/tests/reference/run_dbg-test_quit_01-30889cc.json b/tests/reference/run_dbg-test_quit_01-30889cc.json index ef76ad4e13..d46739a952 100644 --- a/tests/reference/run_dbg-test_quit_01-30889cc.json +++ b/tests/reference/run_dbg-test_quit_01-30889cc.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "run_dbg-test_quit_01-30889cc.stderr", - "stderr_hash": "b98857bfa7103401fe36c73b3ae82c8df55cc695173def2f456b5af0", - "returncode": 0 + "stderr_hash": "b3dac87462f9f0650e5a6af68791137ca9d29f9a64139ba7718a9f96", + "returncode": 10 } \ No newline at end of file diff --git a/tests/reference/run_dbg-test_quit_01-30889cc.stderr b/tests/reference/run_dbg-test_quit_01-30889cc.stderr index 43161a4a47..c1c7a54e60 100644 --- a/tests/reference/run_dbg-test_quit_01-30889cc.stderr +++ b/tests/reference/run_dbg-test_quit_01-30889cc.stderr @@ -1,2 +1,7 @@ -sh: 1: llvm-dwarfdump: not found -Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. + File "tests/runtime_errors/test_quit_01.py", line 1 + def test(): + File "tests/runtime_errors/test_quit_01.py", line 4 + test() + File "tests/runtime_errors/test_quit_01.py", line 2 + quit(10) +STOP diff --git a/tests/reference/run_dbg-test_raise_01-dfd86ca.json b/tests/reference/run_dbg-test_raise_01-dfd86ca.json index c4057ea5df..2dbe004c7e 100644 --- a/tests/reference/run_dbg-test_raise_01-dfd86ca.json +++ b/tests/reference/run_dbg-test_raise_01-dfd86ca.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "run_dbg-test_raise_01-dfd86ca.stderr", - "stderr_hash": "b98857bfa7103401fe36c73b3ae82c8df55cc695173def2f456b5af0", - "returncode": 0 + "stderr_hash": "76085f527077a81ba6457af8f982a497038168f555ab4027d0d6340e", + "returncode": 1 } \ No newline at end of file diff --git a/tests/reference/run_dbg-test_raise_01-dfd86ca.stderr b/tests/reference/run_dbg-test_raise_01-dfd86ca.stderr index 43161a4a47..42bc707825 100644 --- a/tests/reference/run_dbg-test_raise_01-dfd86ca.stderr +++ b/tests/reference/run_dbg-test_raise_01-dfd86ca.stderr @@ -1,2 +1,7 @@ -sh: 1: llvm-dwarfdump: not found -Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. + File "tests/runtime_errors/test_raise_01.py", line 1 + def test(): + File "tests/runtime_errors/test_raise_01.py", line 4 + test() + File "tests/runtime_errors/test_raise_01.py", line 2 + raise +ERROR STOP From 107fe91e42e606e74321f1d2897b37b90fb169c6 Mon Sep 17 00:00:00 2001 From: Kishan Ved <124593234+Kishan-Ved@users.noreply.github.com> Date: Fri, 5 Jan 2024 23:40:14 +0530 Subject: [PATCH 6/7] Added update reference tests command in Linux section --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 828ead055b..50015138c4 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,7 @@ Please follow the below steps for Windows: ```bash ctest + ./run_tests.py -u ./run_tests.py ``` From 7b13badaa0d47e59632b84ae2a8f3887c21379e3 Mon Sep 17 00:00:00 2001 From: Kishan Ved <124593234+Kishan-Ved@users.noreply.github.com> Date: Sat, 6 Jan 2024 12:30:15 +0530 Subject: [PATCH 7/7] Added section update test references (in Linux) --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50015138c4..113e547a75 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,14 @@ Please follow the below steps for Windows: ```bash ctest - ./run_tests.py -u ./run_tests.py ``` +- Update test references: + ``` + ./run_tests.py -u + ``` + - Run integration tests: ```bash