OSDN Git Service

Make using DejaGNU work for libgo testing on a native system.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Jan 2011 21:56:10 +0000 (21:56 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Jan 2011 21:56:10 +0000 (21:56 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168729 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/Makefile.am
libgo/Makefile.in
libgo/testsuite/gotest
libgo/testsuite/lib/libgo.exp
libgo/testsuite/libgo.testmain/testmain.exp

index 0259a0e..46b5924 100644 (file)
@@ -1237,12 +1237,16 @@ CHECK = \
        rm -f $@-log; \
        prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
        test "$${prefix}" != "." || prefix="$(@D)"; \
-       if $(srcdir)/testsuite/gotest --dejagnu=$(use_dejagnu) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" >>$@-log 2>&1; then \
-         echo "PASS: $(@D)"; \
+       if test "$(use_dejagnu)" = "yes"; then \
+         $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)"; \
        else \
-         echo "FAIL: $(@D)"; \
-         cat $@-log; \
-         exit 1; \
+         if $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" >>$@-log 2>&1; then \
+           echo "PASS: $(@D)"; \
+         else \
+           echo "FAIL: $(@D)"; \
+           cat $@-log; \
+           exit 1; \
+         fi; \
        fi
 
 # Build all packages before checking any.
index 8ef2a43..e54fad2 100644 (file)
@@ -1583,12 +1583,16 @@ CHECK = \
        rm -f $@-log; \
        prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
        test "$${prefix}" != "." || prefix="$(@D)"; \
-       if $(srcdir)/testsuite/gotest --dejagnu=$(use_dejagnu) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" >>$@-log 2>&1; then \
-         echo "PASS: $(@D)"; \
+       if test "$(use_dejagnu)" = "yes"; then \
+         $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)"; \
        else \
-         echo "FAIL: $(@D)"; \
-         cat $@-log; \
-         exit 1; \
+         if $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" >>$@-log 2>&1; then \
+           echo "PASS: $(@D)"; \
+         else \
+           echo "FAIL: $(@D)"; \
+           cat $@-log; \
+           exit 1; \
+         fi; \
        fi
 
 
index 13211d0..e8c0847 100755 (executable)
@@ -314,16 +314,26 @@ xno)
        ./a.out "$@"
        ;;
 xyes)
-       # This is the only file which is optionally made.
-       # All others are overwritten on copying/building,
-       # but this may remain and cause conflicts if not
-       # deleted.
-       rm -rf ../testsuite/_xtest_.o
-       cp *.o _testmain.go ../testsuite
+       rm -rf ../testsuite/*.o
+       files=`echo *`
+       for f in $files; do
+               if test "$f" = "_obj" || test "$f" = "_test"; then
+                       continue
+               fi
+               rm -rf ../testsuite/$f
+               if test -f $f; then
+                       cp $f ../testsuite/
+               else
+                       ln -s ../$DIR/$f ../testsuite/
+               fi
+       done
        cd ../testsuite
+       rm -rf _obj _test
+       mkdir _obj _test
        $MAKE check RUNTESTFLAGS="$RUNTESTFLAGS GOTEST_TMPDIR=$DIR"
        # Useful when using make check-target-libgo
        cat libgo.log >> libgo-all.log
        cat libgo.sum >> libgo-all.sum
+       rm -rf $files
        ;;
 esac
index e4be342..29764d9 100644 (file)
@@ -18,7 +18,7 @@ set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
 if {$gccdir != ""} {
     set gccdir [file dirname $gccdir]
 }
-set GO_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
+set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
 set TESTING_IN_BUILD_TREE 1
 
 proc go_maybe_build_wrapper { args } {
index 318ad49..efdd28d 100644 (file)
@@ -17,7 +17,6 @@
 load_lib libgo.exp
 
 lappend options "additional_flags=-I. -w -g"
-lappend ld_options "ldflags=-lgotesting"
 
 if [istarget "*-*-rtems*"] {
     global options
@@ -44,9 +43,9 @@ if [istarget "*-*-rtems*"] {
 }
 
 set object_files [glob -nocomplain "*.o"]
-regsub $gluefile $object_files "" object_files
-
-lappend options $ld_options
+if [info exists gluefile] {
+    regsub $gluefile $object_files "" object_files
+}
 
 set comp_output [go_target_compile "$object_files _testmain.go" \
                         "./a.exe" "executable" $options]
@@ -55,4 +54,7 @@ if ![ string match "" $comp_output ] {
     exit 1
 }
 
-libgo_load "./a.exe" "" ""
+set result [libgo_load "./a.exe" "" ""]
+
+set status [lindex $result 0]
+$status go