diff mbox series

[v4,39/49] tests/tcg/alpha: add Alpha specific tests

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

Commit Message

Alex Bennée May 17, 2018, 5:47 p.m. UTC
These tests did use their own crt.o stub however that is a little
stone age so we drop crt.S and just statically link to the cross
compilers libraries.

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

---
v4
  - drop crt.s
  - drop skipping of threadtest
  - drop write() hack, include unistd.h
---
 tests/tcg/alpha/Makefile        | 35 ---------------------------------
 tests/tcg/alpha/Makefile.target | 15 ++++++++++++++
 tests/tcg/alpha/crt.s           | 26 ------------------------
 tests/tcg/alpha/hello-alpha.c   |  2 ++
 tests/tcg/alpha/test-cond.c     |  1 +
 tests/tcg/alpha/test-ovf.c      |  2 ++
 6 files changed, 20 insertions(+), 61 deletions(-)
 delete mode 100644 tests/tcg/alpha/Makefile
 create mode 100644 tests/tcg/alpha/Makefile.target
 delete mode 100644 tests/tcg/alpha/crt.s

Comments

Richard Henderson May 17, 2018, 8:41 p.m. UTC | #1
On 05/17/2018 10:47 AM, Alex Bennée wrote:
> These tests did use their own crt.o stub however that is a little
> stone age so we drop crt.S and just statically link to the cross
> compilers libraries.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> ---
> v4
>   - drop crt.s
>   - drop skipping of threadtest
>   - drop write() hack, include unistd.h
> ---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Philippe Mathieu-Daudé May 18, 2018, 2:25 p.m. UTC | #2
On 05/17/2018 02:47 PM, Alex Bennée wrote:
> These tests did use their own crt.o stub however that is a little
> stone age so we drop crt.S and just statically link to the cross
> compilers libraries.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> ---
> v4
>   - drop crt.s
>   - drop skipping of threadtest
>   - drop write() hack, include unistd.h
> ---
>  tests/tcg/alpha/Makefile        | 35 ---------------------------------
>  tests/tcg/alpha/Makefile.target | 15 ++++++++++++++
>  tests/tcg/alpha/crt.s           | 26 ------------------------
>  tests/tcg/alpha/hello-alpha.c   |  2 ++
>  tests/tcg/alpha/test-cond.c     |  1 +
>  tests/tcg/alpha/test-ovf.c      |  2 ++
>  6 files changed, 20 insertions(+), 61 deletions(-)
>  delete mode 100644 tests/tcg/alpha/Makefile
>  create mode 100644 tests/tcg/alpha/Makefile.target
>  delete mode 100644 tests/tcg/alpha/crt.s
> 
> diff --git a/tests/tcg/alpha/Makefile b/tests/tcg/alpha/Makefile
> deleted file mode 100644
> index 2b1f03d048..0000000000
> --- a/tests/tcg/alpha/Makefile
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -CROSS=alpha-linux-gnu-
> -CC=$(CROSS)gcc
> -AS=$(CROSS)as
> -
> -SIM=../../alpha-linux-user/qemu-alpha
> -
> -CFLAGS=-O
> -LINK=$(CC) -o $@ crt.o $< -nostdlib
> -
> -TESTS=test-cond test-cmov
> -
> -all: hello-alpha $(TESTS)
> -
> -hello-alpha: hello-alpha.o crt.o
> -	$(LINK)
> -
> -test-cond: test-cond.o crt.o
> -	$(LINK)
> -
> -test-cmov.o: test-cond.c
> -	$(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $<
> -
> -test-cmov: test-cmov.o crt.o
> -	$(LINK)
> -
> -test-ovf: test-ovf.o crt.o
> -	$(LINK)
> -
> -check: $(TESTS)
> -	for f in $(TESTS); do $(SIM) $$f || exit 1; done
> -
> -clean:
> -	$(RM) *.o *~ hello-alpha $(TESTS)
> -
> -.PHONY: clean all check
> diff --git a/tests/tcg/alpha/Makefile.target b/tests/tcg/alpha/Makefile.target
> new file mode 100644
> index 0000000000..b253cee1fc
> --- /dev/null
> +++ b/tests/tcg/alpha/Makefile.target
> @@ -0,0 +1,15 @@
> +# -*- Mode: makefile -*-
> +#
> +# Alpha specific tweaks
> +
> +ALPHA_SRC=$(SRC_PATH)/tests/tcg/alpha
> +VPATH+=$(ALPHA_SRC)
> +
> +ALPHA_TESTS=hello-alpha test-cond test-cmov test-ovf
> +TESTS+=$(ALPHA_TESTS)
> +
> +test-cmov: EXTRA_CFLAGS=-DTEST_CMOV
> +test-cmov: test-cond.c
> +	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
> +
> +run-test-cmov: test-cmov
> diff --git a/tests/tcg/alpha/crt.s b/tests/tcg/alpha/crt.s
> deleted file mode 100644
> index 31af8825bc..0000000000
> --- a/tests/tcg/alpha/crt.s
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -	.text
> -
> -	.globl _start
> -	.ent _start,0
> -_start:
> -	.frame $15,0,$15
> -	br $29,1f
> -1:	ldgp $29, 0($29)
> -	.prologue 0
> -	ldq $27,main($29) !literal!1
> -	jsr $26,($27)
> -	or $0,$0,$16
> -	.end _start
> -
> -	.globl _exit
> -_exit:
> -	lda $0,1
> -	callsys
> -
> -	call_pal 0
> -
> -	.globl write
> -write:
> -	lda $0,4
> -	callsys
> -	ret
> diff --git a/tests/tcg/alpha/hello-alpha.c b/tests/tcg/alpha/hello-alpha.c
> index 79892e6522..84e43b2fc4 100644
> --- a/tests/tcg/alpha/hello-alpha.c
> +++ b/tests/tcg/alpha/hello-alpha.c
> @@ -1,3 +1,5 @@
> +#include <unistd.h>
> +
>  int main (void)
>  {
>    write (1, "hello\n", 6);
> diff --git a/tests/tcg/alpha/test-cond.c b/tests/tcg/alpha/test-cond.c
> index 74adffaa69..e625313b3e 100644
> --- a/tests/tcg/alpha/test-cond.c
> +++ b/tests/tcg/alpha/test-cond.c
> @@ -1,3 +1,4 @@
> +#include <unistd.h>
>  
>  #ifdef TEST_CMOV
>  
> diff --git a/tests/tcg/alpha/test-ovf.c b/tests/tcg/alpha/test-ovf.c
> index 01c80e7525..17892f1e89 100644
> --- a/tests/tcg/alpha/test-ovf.c
> +++ b/tests/tcg/alpha/test-ovf.c
> @@ -1,3 +1,5 @@
> +#include <unistd.h>
> +
>  static long test_subqv (long a, long b)
>  {
>    long res;
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/tests/tcg/alpha/Makefile b/tests/tcg/alpha/Makefile
deleted file mode 100644
index 2b1f03d048..0000000000
--- a/tests/tcg/alpha/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@ 
-CROSS=alpha-linux-gnu-
-CC=$(CROSS)gcc
-AS=$(CROSS)as
-
-SIM=../../alpha-linux-user/qemu-alpha
-
-CFLAGS=-O
-LINK=$(CC) -o $@ crt.o $< -nostdlib
-
-TESTS=test-cond test-cmov
-
-all: hello-alpha $(TESTS)
-
-hello-alpha: hello-alpha.o crt.o
-	$(LINK)
-
-test-cond: test-cond.o crt.o
-	$(LINK)
-
-test-cmov.o: test-cond.c
-	$(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $<
-
-test-cmov: test-cmov.o crt.o
-	$(LINK)
-
-test-ovf: test-ovf.o crt.o
-	$(LINK)
-
-check: $(TESTS)
-	for f in $(TESTS); do $(SIM) $$f || exit 1; done
-
-clean:
-	$(RM) *.o *~ hello-alpha $(TESTS)
-
-.PHONY: clean all check
diff --git a/tests/tcg/alpha/Makefile.target b/tests/tcg/alpha/Makefile.target
new file mode 100644
index 0000000000..b253cee1fc
--- /dev/null
+++ b/tests/tcg/alpha/Makefile.target
@@ -0,0 +1,15 @@ 
+# -*- Mode: makefile -*-
+#
+# Alpha specific tweaks
+
+ALPHA_SRC=$(SRC_PATH)/tests/tcg/alpha
+VPATH+=$(ALPHA_SRC)
+
+ALPHA_TESTS=hello-alpha test-cond test-cmov test-ovf
+TESTS+=$(ALPHA_TESTS)
+
+test-cmov: EXTRA_CFLAGS=-DTEST_CMOV
+test-cmov: test-cond.c
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
+
+run-test-cmov: test-cmov
diff --git a/tests/tcg/alpha/crt.s b/tests/tcg/alpha/crt.s
deleted file mode 100644
index 31af8825bc..0000000000
--- a/tests/tcg/alpha/crt.s
+++ /dev/null
@@ -1,26 +0,0 @@ 
-	.text
-
-	.globl _start
-	.ent _start,0
-_start:
-	.frame $15,0,$15
-	br $29,1f
-1:	ldgp $29, 0($29)
-	.prologue 0
-	ldq $27,main($29) !literal!1
-	jsr $26,($27)
-	or $0,$0,$16
-	.end _start
-
-	.globl _exit
-_exit:
-	lda $0,1
-	callsys
-
-	call_pal 0
-
-	.globl write
-write:
-	lda $0,4
-	callsys
-	ret
diff --git a/tests/tcg/alpha/hello-alpha.c b/tests/tcg/alpha/hello-alpha.c
index 79892e6522..84e43b2fc4 100644
--- a/tests/tcg/alpha/hello-alpha.c
+++ b/tests/tcg/alpha/hello-alpha.c
@@ -1,3 +1,5 @@ 
+#include <unistd.h>
+
 int main (void)
 {
   write (1, "hello\n", 6);
diff --git a/tests/tcg/alpha/test-cond.c b/tests/tcg/alpha/test-cond.c
index 74adffaa69..e625313b3e 100644
--- a/tests/tcg/alpha/test-cond.c
+++ b/tests/tcg/alpha/test-cond.c
@@ -1,3 +1,4 @@ 
+#include <unistd.h>
 
 #ifdef TEST_CMOV
 
diff --git a/tests/tcg/alpha/test-ovf.c b/tests/tcg/alpha/test-ovf.c
index 01c80e7525..17892f1e89 100644
--- a/tests/tcg/alpha/test-ovf.c
+++ b/tests/tcg/alpha/test-ovf.c
@@ -1,3 +1,5 @@ 
+#include <unistd.h>
+
 static long test_subqv (long a, long b)
 {
   long res;