Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / libgo / testsuite / libgo.testmain / testmain.exp
blob318ad499d72a58d55efbf4e493cb662b93123558
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"
20 lappend ld_options "ldflags=-lgotesting"
22 if [istarget "*-*-rtems*"] {
23 global options
25 verbose -log "Executing on host: tar cf FilesystemImage -h -C \
26 $tool_root_dir/$tool/${GOTEST_TMPDIR} ."
27 if [catch "exec tar cf FilesystemImage -h -C \
28 $tool_root_dir/$tool/${GOTEST_TMPDIR} ." error] {
29 perror "Error during tar of local filesystem: $error"
30 exit 1
33 verbose -log "Executing on host: ${RTEMS_BIN2C} FilesystemImage FilesystemImage"
34 if [catch "exec ${RTEMS_BIN2C} FilesystemImage FilesystemImage" error] {
35 perror "Error when creating FilesystemImage source file: $error"
36 exit 1
38 set comp_output [target_compile "${RTEMS_LIBGO_INIT}" \
39 "./rtems_libgo_init.o" "object" $options]
40 if ![ string match "" $comp_output ] {
41 verbose -log $comp_output
42 exit 1
46 set object_files [glob -nocomplain "*.o"]
47 regsub $gluefile $object_files "" object_files
49 lappend options $ld_options
51 set comp_output [go_target_compile "$object_files _testmain.go" \
52 "./a.exe" "executable" $options]
53 if ![ string match "" $comp_output ] {
54 verbose -log $comp_output
55 exit 1
58 libgo_load "./a.exe" "" ""