OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libgo / testsuite / libgo.testmain / testmain.exp
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 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
55 }
56
57 set result [libgo_load "./a.exe" "-test.short" ""]
58
59 set status [lindex $result 0]
60
61 set name "go"
62 if [info exists env(GOTESTNAME)] {
63     set name "$env(GOTESTNAME)"
64 }
65
66 $status $name