public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests: check gcc
@ 2019-05-21  7:01 mingli.yu
  2019-05-21  7:25 ` Dmitry V. Levin
  0 siblings, 1 reply; 7+ messages in thread
From: mingli.yu @ 2019-05-21  7:01 UTC (permalink / raw)
  To: elfutils-devel

From: Mingli Yu <Mingli.Yu@windriver.com>

Both run-disasm-x86-64.sh and run-disasm-x86.sh
need gcc, so check gcc before run the test.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 tests/run-disasm-x86-64.sh | 2 ++
 tests/run-disasm-x86.sh    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62b..c3ef238 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -22,6 +22,8 @@ case "`uname -m`" in
   x86_64)
     tempfiles testfile45.o
     testfiles testfile45.S testfile45.expect
+    # skip the case if no gcc deployed
+    which gcc || exit 77
     gcc -m64 -c -o testfile45.o testfile45.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect
     ;;
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df7..544fc28 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -22,6 +22,8 @@ case "`uname -m`" in
   x86_64 | i?86 )
     tempfiles testfile44.o
     testfiles testfile44.S testfile44.expect
+    # skip the case if no gcc deployed
+    which gcc || exit 77
     gcc -m32 -c -o testfile44.o testfile44.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect
     ;;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tests: check gcc
  2019-05-21  7:01 [PATCH] tests: check gcc mingli.yu
@ 2019-05-21  7:25 ` Dmitry V. Levin
  2019-05-21  7:34   ` [PATCH v2] skip the test when gcc not deployed mingli.yu
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry V. Levin @ 2019-05-21  7:25 UTC (permalink / raw)
  To: elfutils-devel

On Tue, May 21, 2019 at 03:00:31PM +0800, mingli.yu@windriver.com wrote:
> From: Mingli Yu <Mingli.Yu@windriver.com>
> 
> Both run-disasm-x86-64.sh and run-disasm-x86.sh
> need gcc, so check gcc before run the test.

There are several dozens more tests that invoke gcc,
why these two need a check?


-- 
ldv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] skip the test when gcc not deployed
  2019-05-21  7:25 ` Dmitry V. Levin
@ 2019-05-21  7:34   ` mingli.yu
  2019-05-23 11:28     ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: mingli.yu @ 2019-05-21  7:34 UTC (permalink / raw)
  To: elfutils-devel, ldv

From: Mingli Yu <Mingli.Yu@windriver.com>

Skip the tests which depend on gcc when
gcc not deployed.

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
 tests/run-disasm-x86-64.sh | 2 ++
 tests/run-disasm-x86.sh    | 2 ++
 tests/run-strip-g.sh       | 2 ++
 tests/run-strip-nothing.sh | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62b..c3ef238 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -22,6 +22,8 @@ case "`uname -m`" in
   x86_64)
     tempfiles testfile45.o
     testfiles testfile45.S testfile45.expect
+    # skip the case if no gcc deployed
+    which gcc || exit 77
     gcc -m64 -c -o testfile45.o testfile45.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect
     ;;
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df7..544fc28 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -22,6 +22,8 @@ case "`uname -m`" in
   x86_64 | i?86 )
     tempfiles testfile44.o
     testfiles testfile44.S testfile44.expect
+    # skip the case if no gcc deployed
+    which gcc || exit 77
     gcc -m32 -c -o testfile44.o testfile44.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect
     ;;
diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh
index 1303819..a943dec 100755
--- a/tests/run-strip-g.sh
+++ b/tests/run-strip-g.sh
@@ -24,6 +24,8 @@
 
 tempfiles a.out strip.out debug.out readelf.out
 
+# skip the test if gcc deployed
+which gcc || exit 77
 echo Create debug a.out.
 echo "int main() { return 1; }" | gcc -g -xc -
 
diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh
index 914fdfb..d03f734 100755
--- a/tests/run-strip-nothing.sh
+++ b/tests/run-strip-nothing.sh
@@ -22,6 +22,8 @@
 
 tempfiles a.out strip.out debug.out
 
+# skip the case if no gcc deployed
+which gcc || exit 77
 # Create no-debug a.out.
 echo "int main() { return 1; }" | gcc -s -xc -
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] skip the test when gcc not deployed
  2019-05-21  7:34   ` [PATCH v2] skip the test when gcc not deployed mingli.yu
@ 2019-05-23 11:28     ` Mark Wielaard
  2019-05-24  6:41       ` Yu, Mingli
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2019-05-23 11:28 UTC (permalink / raw)
  To: mingli.yu; +Cc: elfutils-devel, ldv

Hi,

On Tue, May 21, 2019 at 03:33:06PM +0800, mingli.yu@windriver.com wrote:
> Skip the tests which depend on gcc when
> gcc not deployed.

What exactly are you trying to do?
When would you run make check without having gcc installed?
If this is to check against an alternative compiler?

In the last case it might be better to make CC available to the tests
environment. Does something like the following work for you?

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 80900e42d..4b7703d8a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -445,7 +445,8 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
 			      export abs_top_builddir; \
 			      export libdir; export bindir; \
 			      export LC_ALL; export LANG; export VALGRIND_CMD; \
-			      NM=$(NM); export NM;
+			      NM=$(NM); export NM; \
+			      CC=$(CC); export CC;
 installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
 			 installed $(tests_rpath) \
 			 '$(program_transform_name)'
@@ -459,7 +460,8 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
 		    export abs_srcdir; export abs_builddir; \
 		    export abs_top_builddir; \
 		    export LC_ALL; export LANG; export VALGRIND_CMD; \
-		    NM=$(NM); export NM;
+		    NM=$(NM); export NM; \
+		    CC=$(CC); export CC;
 LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
 	       $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm
 
diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62bbc..3fe28084f 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64)
     tempfiles testfile45.o
     testfiles testfile45.S testfile45.expect
-    gcc -m64 -c -o testfile45.o testfile45.S
+    $CC -m64 -c -o testfile45.o testfile45.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect
     ;;
 esac
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df740..48cd18030 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64 | i?86 )
     tempfiles testfile44.o
     testfiles testfile44.S testfile44.expect
-    gcc -m32 -c -o testfile44.o testfile44.S
+    $CC -m32 -c -o testfile44.o testfile44.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect
     ;;
 esac
diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh
index 13038195d..b30b39f1a 100755
--- a/tests/run-strip-g.sh
+++ b/tests/run-strip-g.sh
@@ -25,7 +25,7 @@
 tempfiles a.out strip.out debug.out readelf.out
 
 echo Create debug a.out.
-echo "int main() { return 1; }" | gcc -g -xc -
+echo "int main() { return 1; }" | $CC -g -xc -
 
 echo strip -g to file with debug file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out ||
diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh
index 914fdfbf0..4867a82fa 100755
--- a/tests/run-strip-nothing.sh
+++ b/tests/run-strip-nothing.sh
@@ -23,7 +23,7 @@
 tempfiles a.out strip.out debug.out
 
 # Create no-debug a.out.
-echo "int main() { return 1; }" | gcc -s -xc -
+echo "int main() { return 1; }" | $CC -s -xc -
 
 # strip to file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out ||

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] skip the test when gcc not deployed
  2019-05-23 11:28     ` Mark Wielaard
@ 2019-05-24  6:41       ` Yu, Mingli
  2019-05-24  7:03         ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Yu, Mingli @ 2019-05-24  6:41 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel, ldv



On 2019年05月23日 19:28, Mark Wielaard wrote:
> Hi,
>
> On Tue, May 21, 2019 at 03:33:06PM +0800, mingli.yu@windriver.com wrote:
>> Skip the tests which depend on gcc when
>> gcc not deployed.
>
> What exactly are you trying to do?
> When would you run make check without having gcc installed?

Thanks Mark!
I just run the check without having gcc installed, and of cource no 
compiler installed in my test env.

Thanks,

> If this is to check against an alternative compiler?
>
> In the last case it might be better to make CC available to the tests
> environment. Does something like the following work for you?
>
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 80900e42d..4b7703d8a 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -445,7 +445,8 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
>   			      export abs_top_builddir; \
>   			      export libdir; export bindir; \
>   			      export LC_ALL; export LANG; export VALGRIND_CMD; \
> -			      NM=$(NM); export NM;
> +			      NM=$(NM); export NM; \
> +			      CC=$(CC); export CC;
>   installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
>   			 installed $(tests_rpath) \
>   			 '$(program_transform_name)'
> @@ -459,7 +460,8 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
>   		    export abs_srcdir; export abs_builddir; \
>   		    export abs_top_builddir; \
>   		    export LC_ALL; export LANG; export VALGRIND_CMD; \
> -		    NM=$(NM); export NM;
> +		    NM=$(NM); export NM; \
> +		    CC=$(CC); export CC;
>   LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
>   	       $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm
>
> diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
> index a6be62bbc..3fe28084f 100755
> --- a/tests/run-disasm-x86-64.sh
> +++ b/tests/run-disasm-x86-64.sh
> @@ -22,7 +22,7 @@ case "`uname -m`" in
>     x86_64)
>       tempfiles testfile45.o
>       testfiles testfile45.S testfile45.expect
> -    gcc -m64 -c -o testfile45.o testfile45.S
> +    $CC -m64 -c -o testfile45.o testfile45.S
>       testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect
>       ;;
>   esac
> diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
> index 28a3df740..48cd18030 100755
> --- a/tests/run-disasm-x86.sh
> +++ b/tests/run-disasm-x86.sh
> @@ -22,7 +22,7 @@ case "`uname -m`" in
>     x86_64 | i?86 )
>       tempfiles testfile44.o
>       testfiles testfile44.S testfile44.expect
> -    gcc -m32 -c -o testfile44.o testfile44.S
> +    $CC -m32 -c -o testfile44.o testfile44.S
>       testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect
>       ;;
>   esac
> diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh
> index 13038195d..b30b39f1a 100755
> --- a/tests/run-strip-g.sh
> +++ b/tests/run-strip-g.sh
> @@ -25,7 +25,7 @@
>   tempfiles a.out strip.out debug.out readelf.out
>
>   echo Create debug a.out.
> -echo "int main() { return 1; }" | gcc -g -xc -
> +echo "int main() { return 1; }" | $CC -g -xc -
>
>   echo strip -g to file with debug file
>   testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out ||
> diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh
> index 914fdfbf0..4867a82fa 100755
> --- a/tests/run-strip-nothing.sh
> +++ b/tests/run-strip-nothing.sh
> @@ -23,7 +23,7 @@
>   tempfiles a.out strip.out debug.out
>
>   # Create no-debug a.out.
> -echo "int main() { return 1; }" | gcc -s -xc -
> +echo "int main() { return 1; }" | $CC -s -xc -
>
>   # strip to file
>   testrun ${abs_top_builddir}/src/strip -g -o strip.out ||
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] skip the test when gcc not deployed
  2019-05-24  6:41       ` Yu, Mingli
@ 2019-05-24  7:03         ` Mark Wielaard
  2019-05-24  7:12           ` Yu, Mingli
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2019-05-24  7:03 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: elfutils-devel, ldv

Hi,

On Fri, May 24, 2019 at 02:47:25PM +0800, Yu, Mingli wrote:
> > On Tue, May 21, 2019 at 03:33:06PM +0800, mingli.yu@windriver.com wrote:
> > > Skip the tests which depend on gcc when
> > > gcc not deployed.
> > 
> > What exactly are you trying to do?
> > When would you run make check without having gcc installed?
> 
> Thanks Mark!
> I just run the check without having gcc installed, and of cource no compiler
> installed in my test env.

I don't think that is a realistic test environment for testing the
elfutils libraries. You have to have the tools to create various ELF
files and DWARF data to properly test things work correctly.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] skip the test when gcc not deployed
  2019-05-24  7:03         ` Mark Wielaard
@ 2019-05-24  7:12           ` Yu, Mingli
  0 siblings, 0 replies; 7+ messages in thread
From: Yu, Mingli @ 2019-05-24  7:12 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel, ldv



On 2019年05月24日 15:03, Mark Wielaard wrote:
> Hi,
>
> On Fri, May 24, 2019 at 02:47:25PM +0800, Yu, Mingli wrote:
>>> On Tue, May 21, 2019 at 03:33:06PM +0800, mingli.yu@windriver.com wrote:
>>>> Skip the tests which depend on gcc when
>>>> gcc not deployed.
>>>
>>> What exactly are you trying to do?
>>> When would you run make check without having gcc installed?
>>
>> Thanks Mark!
>> I just run the check without having gcc installed, and of cource no compiler
>> installed in my test env.
>
> I don't think that is a realistic test environment for testing the
> elfutils libraries. You have to have the tools to create various ELF
> files and DWARF data to properly test things work correctly.

Yes, we use elfutils in cross compile env, one works as build host which 
we build all the packages and of course gcc installed on the build host 
and another as target which only deployed the necessary packages which 
we have build on the build host.
And this is the case we just run the test on the target.

I think it make sense to check the gcc and make it skip if the cases 
depends on gcc.

Thanks,

>
> Cheers,
>
> Mark
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-24  7:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  7:01 [PATCH] tests: check gcc mingli.yu
2019-05-21  7:25 ` Dmitry V. Levin
2019-05-21  7:34   ` [PATCH v2] skip the test when gcc not deployed mingli.yu
2019-05-23 11:28     ` Mark Wielaard
2019-05-24  6:41       ` Yu, Mingli
2019-05-24  7:03         ` Mark Wielaard
2019-05-24  7:12           ` Yu, Mingli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).