2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / libgo / testsuite / libgo.testmain / testmain.exp
blob0b887ac3efdd7cfd3df94f40bb24db648410a51c
1 # Copyright (C) 2010 Free Software Foundation, Inc.
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.
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.
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/>.
17 load_lib libgo.exp
19 lappend options "additional_flags=-I. -w -g"
21 if [istarget "*-*-rtems*"] {
22 global options
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
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
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
45 set object_files [glob -nocomplain "*.o"]
46 if [info exists gluefile] {
47 regsub $gluefile $object_files "" object_files
50 set comp_output [go_target_compile "$object_files _testmain.go" \
51 "./a.exe" "executable" $options]
52 if ![ string match "" $comp_output ] {
53 verbose -log $comp_output
54 exit 1
57 set result [libgo_load "./a.exe" "-test.short" ""]
59 set status [lindex $result 0]
61 set name "go"
62 if [info exists env(GOTESTNAME)] {
63 set name "$env(GOTESTNAME)"
66 $status $name