Hello Giacomo Travaglini,

I'd like you to do a code review. Please visit

    https://gem5-review.googlesource.com/6624

to review the following change.


Change subject: scons, tests: Add support for GTest XML generation
......................................................................

scons, tests: Add support for GTest XML generation

The GTest framework supports result generation in XML (JUnit). Enable
this by creating unit test specific targets in the
build/${BUILD_OPTS}/unittests.${VARIANT} directory. Targets in the
directory use the following naming convention:

${SRC_PATH}/${TEST_NAME}.xml

For example, the opt version of the bitunion test built for ARM would
have this path:

build/ARM/unittests.opt/base/bituniontest.xml

Change-Id: I174dff16817734db05b08ce1d5bcf52e8697bbac
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-by: Jack Travaglini <giacomo.travagl...@arm.com>
---
M src/SConscript
1 file changed, 6 insertions(+), 5 deletions(-)



diff --git a/src/SConscript b/src/SConscript
index 57a2d96..a98fbc4 100755
--- a/src/SConscript
+++ b/src/SConscript
@@ -1090,7 +1090,7 @@
     gtest_env.Append(LIBS=gtest_env['GTEST_LIBS'])
     gtest_env.Append(CPPFLAGS=gtest_env['GTEST_CPPFLAGS'])
     gtestlib_sources = Source.all.with_tag('gtest lib')
-    gtests = []
+    gtest_out_dir = Dir(new_env['BUILDDIR']).Dir('unittests.%s' % label)
     for test in GTest.all:
         test_sources = test.sources
         if not test.skip_lib:
@@ -1098,11 +1098,12 @@
         for f in test.filters:
             test_sources += Source.all.apply_filter(f)
         test_objs = [ s.static(gtest_env) for s in test_sources ]
-        gtests.append(gtest_env.Program(
-            test.dir.File('%s.%s' % (test.target, label)), test_objs))
+        test_binary = gtest_env.Program(
+            test.dir.File('%s.%s' % (test.target, label)), test_objs)

-    gtest_target = Dir(new_env['BUILDDIR']).File('unittests.%s' % label)
-    AlwaysBuild(gtest_env.Command(gtest_target, gtests, gtests))
+        AlwaysBuild(gtest_env.Command(
+            gtest_out_dir.File("%s/%s.xml" % (test.dir, test.target)),
+            test_binary, "${SOURCES[0]} --gtest_output=xml:${TARGETS[0]}"))

     progname = exename
     if strip:

--
To view, visit https://gem5-review.googlesource.com/6624
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I174dff16817734db05b08ce1d5bcf52e8697bbac
Gerrit-Change-Number: 6624
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to