diff mbox series

[v2,05/16] tests/tcg/mips: fix hello-mips compilation

Message ID 20190228202537.4638-6-alex.bennee@linaro.org
State Superseded
Headers show
Series Enabling tcg/tests for cris and system mode xtensa & arm | expand

Commit Message

Alex Bennée Feb. 28, 2019, 8:25 p.m. UTC
The compilation flags for proper building are in the source tree. We
also fix exit to 0 so the result is counted as a success.

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

---
 tests/tcg/mips/Makefile.target | 11 ++++-------
 tests/tcg/mips/hello-mips.c    |  2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé Feb. 28, 2019, 10:42 p.m. UTC | #1
Hi Alex,

On 2/28/19 9:25 PM, Alex Bennée wrote:
> The compilation flags for proper building are in the source tree. We

> also fix exit to 0 so the result is counted as a success.

> 

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

> ---

>  tests/tcg/mips/Makefile.target | 11 ++++-------

>  tests/tcg/mips/hello-mips.c    |  2 +-

>  2 files changed, 5 insertions(+), 8 deletions(-)

> 

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

> index 086625f533..1a994d5525 100644

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

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

> @@ -8,15 +8,12 @@ MIPS_SRC=$(SRC_PATH)/tests/tcg/mips

>  # Set search path for all sources

>  VPATH 		+= $(MIPS_SRC)

>  

> +# hello-mips is 32 bit only


Correct.

> +ifeq ($(findstring 64,$(TARGET_NAME)),)

>  MIPS_TESTS=hello-mips

>  

>  TESTS += $(MIPS_TESTS)

>  

> -hello-mips: CFLAGS+=-ffreestanding

> +hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32


As suggested in the header.

>  hello-mips: LDFLAGS+=-nostdlib

> -

> -# For MIPS32 and 64 we have a bunch of extra tests in sub-directories

> -# however they are intended for system tests.

> -

> -run-hello-mips: hello-mips

> -	$(call skip-test, $<, "BROKEN")

> +endif

> diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c

> index c7052fdf2e..4e1cf501af 100644

> --- a/tests/tcg/mips/hello-mips.c

> +++ b/tests/tcg/mips/hello-mips.c

> @@ -60,5 +60,5 @@ static inline int write(int fd, const char *buf, int len)

>  void __start(void)

>  {

>      write (1, "Hello, World!\n", 14);

> -    exit1 (42);


I understand 42 is to check SYS_exit1 worked, and this is not another
qemu-user exit. But we were previously never checked the exit code for
42. Neither are we checking 'Hello, World' on stdout.

> +    exit1(0);

>  }

>
Alex Bennée March 1, 2019, 9:31 a.m. UTC | #2
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi Alex,

>

> On 2/28/19 9:25 PM, Alex Bennée wrote:

>> The compilation flags for proper building are in the source tree. We

>> also fix exit to 0 so the result is counted as a success.

>>

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

>> ---

>>  tests/tcg/mips/Makefile.target | 11 ++++-------

>>  tests/tcg/mips/hello-mips.c    |  2 +-

>>  2 files changed, 5 insertions(+), 8 deletions(-)

>>

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

>> index 086625f533..1a994d5525 100644

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

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

>> @@ -8,15 +8,12 @@ MIPS_SRC=$(SRC_PATH)/tests/tcg/mips

>>  # Set search path for all sources

>>  VPATH 		+= $(MIPS_SRC)

>>

>> +# hello-mips is 32 bit only

>

> Correct.

>

>> +ifeq ($(findstring 64,$(TARGET_NAME)),)

>>  MIPS_TESTS=hello-mips

>>

>>  TESTS += $(MIPS_TESTS)

>>

>> -hello-mips: CFLAGS+=-ffreestanding

>> +hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32

>

> As suggested in the header.

>

>>  hello-mips: LDFLAGS+=-nostdlib

>> -

>> -# For MIPS32 and 64 we have a bunch of extra tests in sub-directories

>> -# however they are intended for system tests.

>> -

>> -run-hello-mips: hello-mips

>> -	$(call skip-test, $<, "BROKEN")

>> +endif

>> diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c

>> index c7052fdf2e..4e1cf501af 100644

>> --- a/tests/tcg/mips/hello-mips.c

>> +++ b/tests/tcg/mips/hello-mips.c

>> @@ -60,5 +60,5 @@ static inline int write(int fd, const char *buf, int len)

>>  void __start(void)

>>  {

>>      write (1, "Hello, World!\n", 14);

>> -    exit1 (42);

>

> I understand 42 is to check SYS_exit1 worked, and this is not another

> qemu-user exit. But we were previously never checked the exit code for

> 42. Neither are we checking 'Hello, World' on stdout.


Hmm we could do better but this is pretty much a smoke test anyway.
Either things are so broken it crashes out (which we should detect) or
we exit with a 0 indicating a pass to the calling make.

Once we have a more use cases for non-zero exits we can come up with
some plumbing for checking things.

>

>> +    exit1(0);

>>  }

>>



--
Alex Bennée
diff mbox series

Patch

diff --git a/tests/tcg/mips/Makefile.target b/tests/tcg/mips/Makefile.target
index 086625f533..1a994d5525 100644
--- a/tests/tcg/mips/Makefile.target
+++ b/tests/tcg/mips/Makefile.target
@@ -8,15 +8,12 @@  MIPS_SRC=$(SRC_PATH)/tests/tcg/mips
 # Set search path for all sources
 VPATH 		+= $(MIPS_SRC)
 
+# hello-mips is 32 bit only
+ifeq ($(findstring 64,$(TARGET_NAME)),)
 MIPS_TESTS=hello-mips
 
 TESTS += $(MIPS_TESTS)
 
-hello-mips: CFLAGS+=-ffreestanding
+hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -mabi=32
 hello-mips: LDFLAGS+=-nostdlib
-
-# For MIPS32 and 64 we have a bunch of extra tests in sub-directories
-# however they are intended for system tests.
-
-run-hello-mips: hello-mips
-	$(call skip-test, $<, "BROKEN")
+endif
diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c
index c7052fdf2e..4e1cf501af 100644
--- a/tests/tcg/mips/hello-mips.c
+++ b/tests/tcg/mips/hello-mips.c
@@ -60,5 +60,5 @@  static inline int write(int fd, const char *buf, int len)
 void __start(void)
 {
     write (1, "Hello, World!\n", 14);
-    exit1 (42);
+    exit1(0);
 }