From 131d181b4003b9e275d9b74f071604da0b7743f9 Mon Sep 17 00:00:00 2001 From: Burhan Rajgara Date: Fri, 14 Jun 2024 15:15:57 -0700 Subject: [PATCH] Revert "more tests for iip_c for armhf" This reverts commit 2b4dd15c39ffa11f024b3cb0228287a169bad7f0. --- tests/test_arm.py | 86 ------------------- tests/test_binaries/armhf/iip_c_asm_header | Bin 6296 -> 0 bytes tests/test_binaries/armhf/iip_c_asm_header.c | 21 ----- tests/test_binaries/armhf/iip_c_float | Bin 6096 -> 0 bytes tests/test_binaries/armhf/iip_c_float.c | 17 ---- 5 files changed, 124 deletions(-) delete mode 100755 tests/test_binaries/armhf/iip_c_asm_header delete mode 100644 tests/test_binaries/armhf/iip_c_asm_header.c delete mode 100755 tests/test_binaries/armhf/iip_c_float delete mode 100644 tests/test_binaries/armhf/iip_c_float.c diff --git a/tests/test_arm.py b/tests/test_arm.py index b1f3301..e034b80 100755 --- a/tests/test_arm.py +++ b/tests/test_arm.py @@ -331,92 +331,6 @@ def test_insert_instruction_patch_c(self): expected_returnCode=0, ) - def test_insert_instruction_patch_c_asm_header(self): - asm_header = "mov r12, r11" - - # Original computation computed the area as pi * radius - # Here our micropatch loops over the areas array and multiplies by another radius to fix the bug - instrs = """ - int num_radii = *((int *) (r12 - 0x10)); - float *areas = *((float **) (r12 - 0x20)); - float *radii = *((float **) (r12 - 0x0c)); - for (int i = 0; i < num_radii; i++) { - areas[i] *= radii[i]; - } - """ - - config = InsertInstructionPatch.CConfig( - asm_header=asm_header, - scratch_regs=[ - "r0", - "r1", - "r2", - "r3", - "d0", - "d1", - "d2", - "d3", - "d4", - "d5", - "d6", - "d7", - ], - ) - - expected_output = b"".join( - [ - b"The area of the circle with radius 1.500000 is 7.065000\n", - b"The area of the circle with radius 2.000000 is 12.560000\n", - b"The area of the circle with radius 4.300000 is 58.058605\n", - ] - ) - - self.run_one( - "iip_c_asm_header", - [InsertInstructionPatch(0x1077C, instrs, language="C", c_config=config)], - expected_output=expected_output, - expected_returnCode=0, - ) - - def test_insert_instruction_patch_c_float(self): - # Original computation calculated the square magnitude of a 3D vector as x^2 + y^2 - # Here we insert an additional step to fix the calculation to be x^2 + y^2 + z^2 - instrs = """ - s6 = *(float*)r12; - s0 += s6 * s6; - """ - - config = InsertInstructionPatch.CConfig( - asm_header="mov r12, r13", - scratch_regs=[ - "r0", - "r1", - "r2", - "r3", - "d4", - "d5", - "d6", - "d7", - ], - regs_sort=["s0", "s2", "s4", "s6"], - ) - - expected_output = b"".join( - [ - b"The square magnitude of the vector (0.000000, 0.000000, 0.000000) is 0.000000\n", - b"The square magnitude of the vector (1.000000, 2.000000, 3.000000) is 14.000000\n", - b"The square magnitude of the vector (-20.000000, 33.200001, 5.200000) is 1529.280029\n", - b"The square magnitude of the vector (3.000000, 4.000000, 0.000000) is 25.000000\n", - ] - ) - - self.run_one( - "iip_c_float", - [InsertInstructionPatch(0x1067C, instrs, language="C", c_config=config)], - expected_output=expected_output, - expected_returnCode=0, - ) - def run_one( self, filename, diff --git a/tests/test_binaries/armhf/iip_c_asm_header b/tests/test_binaries/armhf/iip_c_asm_header deleted file mode 100755 index b6365cc5df5133ea7d7150b1a03e0f9051e15fcf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6296 zcmd5=Yiu0V6~41;$Lj}VojBk}AVV73(8SBG;}D>z*v=-gv7H2Bq)Nwqki4z%#wh@nPzi(#l zG8m&){ncZiJ@>okanF6soqOk@O#_=1MG=zxVznUBs}<1+*}D`!Rie66sG$iC|^f!T-H}yXJ7U5rnKlv;$nR@1MPsvIw6kq1Q9r^(zBe?-S zWa`OxLl5x@a@u!n&Z3i&Z-pgU`a_kSM1Lg*p(9KE%}FzMb28DMG}DD*yPivpjfC=< z&^nmdHnim!ZrOS-tL*t;pGk~?uG@9g$9`PuTe0@cG<9C0zoaE7V0bG;%=wh0qQEhh zq@oa&0FwC29=sCelm|1Oz^wR@HUE709PQTbsC5ZX5 zUzDxj3hA*-&Jvo2F^g+?OV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mb< z#giy}wB}mG)4zlO!j$bfv|NnBROYYvTEuluC|k|(4g(K++FK7i<-xZD zzvaPq0#8)tJ1C;SA3du<(MNlaek-sfws#-!Np27}HHcjv%=t|N@8l+9(_-;e4_3rt zaU=RunSWoacnJD;EA2IkeZU`7@DlMTu)ROn@s^7Hz(MX8F8(%(ss}#?yw-ys2M&Ai zlfZX)@YBFu9()9Nz=NL!-tNH@z`H#781S$M{}4Fo!LI}JJZqEhTJao;ykj}|8u26O zC2^1cIWX^L?o2;mA~NHLrwnZ@0dI*!$TEs>Fw-V}ae*;K$d16Grss0{ZbvE0Xi`s^ zab%QXJ4P~>(Xx6XVW!bJr%@}V#d&Gc&@OIGv~*&|@_8pE-Li6KtY8_y@k}aZq!9~a zU?-X%%Ue08F=R$0XEzb@i>GO0aa==W@>XGFBot>I zP0Um_X&MP_BxYK9gu}&78|d3Hq-o-#+ny#<&&y^kA@6%$ozp&VlZlKrn#{!Xq?WKU zxxA(qifj>`$|eoVNZ>^bxS$=ci|!C>7=YYvw&_e!qL4}f($Q0)agv;QkPZo9nprKb z>G_m4X6Wb%d#u~7h9WF=APl|;pw!9I`u{jIcB`B3=^osqZQ2^e@L)LIe{>t=PycnV z*!JaG*q3WA2E!7cApB- - -void print_areas(float *radii, float *areas, int num_circles) { - for (int i = 0; i < num_circles; i++) { - printf("The area of the circle with radius %f is %f\n", radii[i], areas[i]); - } -} - -void compute_areas(float *radii, int num_radii) { - float areas[num_radii]; - for (int i = 0; i < num_radii; i++) { - // Error is here! We should have multiplied by another radius, but we forgot :( - areas[i] = 3.14 * radii[i]; - } - print_areas(radii, areas, num_radii); -} - -void main() { - float radii[3] = { 1.5, 2.0, 4.3 }; - compute_areas(radii, 3); -} \ No newline at end of file diff --git a/tests/test_binaries/armhf/iip_c_float b/tests/test_binaries/armhf/iip_c_float deleted file mode 100755 index 53d512134ece7dc16632f06042d79378dfda2dc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6096 zcmd5=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) { - float mag2 = magnitude2(x, y, z); - printf("The square magnitude of the vector (%f, %f, %f) is %f\n", x, y, z, mag2); -} - -void main() { - test(0.0f, 0.0f, 0.0f); - test(1.0f, 2.0f, 3.0f); - test(-20.0f, 33.2f, 5.2f); - test(3.0f, 4.0f, 0.0f); -} \ No newline at end of file