diff mbox series

[v4,21/49] tests/tcg/i386: add runner for test-i386-fprem

Message ID 20180517174718.10107-22-alex.bennee@linaro.org
State Superseded
Headers show
Series fix building of tests/tcg | expand

Commit Message

Alex Bennée May 17, 2018, 5:46 p.m. UTC
The runner needs to compare against a reference run. We also only run
this test when SPEED=slow as it takes a while.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/tcg/i386/Makefile.target   | 11 +++++++++++
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

-- 
2.17.0

Comments

Paolo Bonzini May 18, 2018, 11:30 a.m. UTC | #1
On 17/05/2018 19:46, Alex Bennée wrote:
> The runner needs to compare against a reference run. We also only run

> this test when SPEED=slow as it takes a while.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/tcg/i386/Makefile.target   | 11 +++++++++++

>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---

>  2 files changed, 20 insertions(+), 3 deletions(-)

> 

> diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target

> index 39a1627650..94fa50abbc 100644

> --- a/tests/tcg/i386/Makefile.target

> +++ b/tests/tcg/i386/Makefile.target

> @@ -37,3 +37,14 @@ pi_10.com:

>  run-runcom: runcom pi_10.com

>  	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")

>  

> +ifeq ($(SPEED), slow)

> +run-test-i386-fprem: test-i386-fprem

> +	$(call quiet-command, \

> +		$(QEMU) $< > $<.out && \

> +		diff -u $(I386_SRC)/$<.ref $<.out, \

> +		"TEST", "$< (default) on $(TARGET_NAME)")


Where is the .ref file created?

Thanks,

Paolo
Alex Bennée May 18, 2018, 12:27 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 17/05/2018 19:46, Alex Bennée wrote:

>> The runner needs to compare against a reference run. We also only run

>> this test when SPEED=slow as it takes a while.

>>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> ---

>>  tests/tcg/i386/Makefile.target   | 11 +++++++++++

>>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---

>>  2 files changed, 20 insertions(+), 3 deletions(-)

>>

>> diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target

>> index 39a1627650..94fa50abbc 100644

>> --- a/tests/tcg/i386/Makefile.target

>> +++ b/tests/tcg/i386/Makefile.target

>> @@ -37,3 +37,14 @@ pi_10.com:

>>  run-runcom: runcom pi_10.com

>>  	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")

>>

>> +ifeq ($(SPEED), slow)

>> +run-test-i386-fprem: test-i386-fprem

>> +	$(call quiet-command, \

>> +		$(QEMU) $< > $<.out && \

>> +		diff -u $(I386_SRC)/$<.ref $<.out, \

>> +		"TEST", "$< (default) on $(TARGET_NAME)")

>

> Where is the .ref file created?


Ooops, forgot to commit that.

I just manually ran it against real hardware ;-)

>

> Thanks,

>

> Paolo



--
Alex Bennée
diff mbox series

Patch

diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target
index 39a1627650..94fa50abbc 100644
--- a/tests/tcg/i386/Makefile.target
+++ b/tests/tcg/i386/Makefile.target
@@ -37,3 +37,14 @@  pi_10.com:
 run-runcom: runcom pi_10.com
 	$(call quiet-command, $(QEMU) ./runcom ./pi_10.com > runcom.out, "TEST", "$< on $(TARGET_NAME)")
 
+ifeq ($(SPEED), slow)
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, \
+		$(QEMU) $< > $<.out && \
+		diff -u $(I386_SRC)/$<.ref $<.out, \
+		"TEST", "$< (default) on $(TARGET_NAME)")
+else
+run-test-i386-fprem: test-i386-fprem
+	$(call quiet-command, /bin/true, "SLOW TEST", "$< SKIPPED on $(TARGET_NAME)")
+endif
+
diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
index 1a71623204..66f5a9657d 100644
--- a/tests/tcg/i386/test-i386-fprem.c
+++ b/tests/tcg/i386/test-i386-fprem.c
@@ -23,7 +23,10 @@ 
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
+#include <stdio.h>
+#include <stdint.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /*
  * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
@@ -39,7 +42,7 @@  union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee;
+    } __attribute__((packed)) ieee;
 
     /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
     struct {
@@ -49,7 +52,7 @@  union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee_nan;
+    } __attribute__((packed)) ieee_nan;
 };
 
 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
@@ -229,6 +232,7 @@  static void test_fprem_cases(void)
     do_fprem_stack_underflow();
 
     printf("= invalid operation =\n");
+    do_fprem(q_nan.d, 1.0);
     do_fprem(s_nan.d, 1.0);
     do_fprem(1.0, 0.0);
     do_fprem(pos_inf.d, 1.0);
@@ -238,6 +242,8 @@  static void test_fprem_cases(void)
     do_fprem(pos_denorm.d, 1.0);
     do_fprem(1.0, pos_denorm.d);
 
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
+
     /* printf("= underflow =\n"); */
     /* TODO: Is there a case where FPREM raises underflow? */
 }