This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgo patch committed: Build targets for benchmarks
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 01 Jul 2014 16:19:28 -0700
- Subject: libgo patch committed: Build targets for benchmarks
- Authentication-results: sourceware.org; auth=none
This patch from Peter Collingbourne makes it easier to run the libgo
benchmarks using "make bench" in the libgo build directory.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r 7650eafca8af libgo/Makefile.am
--- a/libgo/Makefile.am Tue Jun 24 16:49:15 2014 -0700
+++ b/libgo/Makefile.am Tue Jul 01 16:18:18 2014 -0700
@@ -1996,6 +1996,7 @@
$(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files
GOTESTFLAGS =
+GOBENCH =
# Check a package.
CHECK = \
@@ -2015,6 +2016,8 @@
rm -f $@-testsum $@-testlog; \
if test "$(USE_DEJAGNU)" = "yes"; then \
$(SHELL) $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \
+ elif test "$(GOBENCH)" != ""; then \
+ $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \
else \
if $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \
echo "PASS: $(@D)" >> $@-testlog; \
@@ -3845,6 +3848,9 @@
check-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
+bench:
+ -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
+
MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
mostlyclean-local:
diff -r 7650eafca8af libgo/testsuite/gotest
--- a/libgo/testsuite/gotest Tue Jun 24 16:49:15 2014 -0700
+++ b/libgo/testsuite/gotest Tue Jul 01 16:18:18 2014 -0700
@@ -36,6 +36,7 @@
GOARCH=""
timeout=240
testname=""
+bench=""
trace=false
while $loop; do
case "x$1" in
@@ -124,6 +125,15 @@
testname=`echo $1 | sed -e 's/^--testname=//'`
shift
;;
+ x--bench)
+ bench=$2
+ shift
+ shift
+ ;;
+ x--bench=*)
+ bench=`echo $1 | sed -e 's/^--bench=//'`
+ shift
+ ;;
x--trace)
trace=true
shift
@@ -473,20 +483,28 @@
fi
${GL} *.o ${GOLIBS}
- if test "$trace" = "true"; then
- echo ./a.out -test.short -test.timeout=${timeout}s "$@"
- fi
- ./a.out -test.short -test.timeout=${timeout}s "$@" &
- pid=$!
- (sleep `expr $timeout + 10`
- echo > gotest-timeout
- echo "timed out in gotest" 1>&2
- kill -9 $pid) &
- alarmpid=$!
- wait $pid
- status=$?
- if ! test -f gotest-timeout; then
- kill $alarmpid
+ if test "$bench" = ""; then
+ if test "$trace" = "true"; then
+ echo ./a.out -test.short -test.timeout=${timeout}s "$@"
+ fi
+ ./a.out -test.short -test.timeout=${timeout}s "$@" &
+ pid=$!
+ (sleep `expr $timeout + 10`
+ echo > gotest-timeout
+ echo "timed out in gotest" 1>&2
+ kill -9 $pid) &
+ alarmpid=$!
+ wait $pid
+ status=$?
+ if ! test -f gotest-timeout; then
+ kill $alarmpid
+ fi
+ else
+ if test "$trace" = "true"; then
+ echo ./a.out -test.run=^\$ -test.bench="${bench}" "$@"
+ fi
+ ./a.out -test.run=^\$ -test.bench="${bench}" "$@"
+ status=$?
fi
exit $status
;;