github.com/golang/gofrontend@v0.0.0-20240429183944-60f985a78526/libgo/testsuite/libgo.testmain/testmain.exp (about) 1 # Copyright (C) 2010 Free Software Foundation, Inc. 2 3 # This program is free software; you can redistribute it and/or modify 4 # it under the terms of the GNU General Public License as published by 5 # the Free Software Foundation; either version 3 of the License, or 6 # (at your option) any later version. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # along with GCC; see the file COPYING3. If not see 15 # <http://www.gnu.org/licenses/>. 16 17 load_lib libgo.exp 18 19 lappend options "additional_flags=-I. -w -g" 20 21 if [istarget "*-*-rtems*"] { 22 global options 23 24 verbose -log "Executing on host: tar cf FilesystemImage -h -C \ 25 $tool_root_dir/$tool/${GOTEST_TMPDIR} ." 26 if [catch "exec tar cf FilesystemImage -h -C \ 27 $tool_root_dir/$tool/${GOTEST_TMPDIR} ." error] { 28 perror "Error during tar of local filesystem: $error" 29 exit 1 30 } 31 32 verbose -log "Executing on host: ${RTEMS_BIN2C} FilesystemImage FilesystemImage" 33 if [catch "exec ${RTEMS_BIN2C} FilesystemImage FilesystemImage" error] { 34 perror "Error when creating FilesystemImage source file: $error" 35 exit 1 36 } 37 set comp_output [target_compile "${RTEMS_LIBGO_INIT}" \ 38 "./rtems_libgo_init.o" "object" $options] 39 if ![ string match "" $comp_output ] { 40 verbose -log $comp_output 41 exit 1 42 } 43 } 44 45 set object_files [glob -nocomplain "*.o"] 46 if [info exists gluefile] { 47 regsub $gluefile $object_files "" object_files 48 } 49 50 set golibs "" 51 if [info exists env(GOLIBS)] { 52 set golibs "$env(GOLIBS)" 53 } 54 set comp_output [go_target_compile "$object_files _testmain.go $golibs" \ 55 "./a.exe" "executable" $options] 56 if ![ string match "" $comp_output ] { 57 verbose -log $comp_output 58 exit 1 59 } 60 61 set result [libgo_load "./a.exe" "-test.short" ""] 62 63 set status [lindex $result 0] 64 65 set name "go" 66 if [info exists env(GOTESTNAME)] { 67 set name "$env(GOTESTNAME)" 68 } 69 70 $status $name