testmain.exp 2.0 KB

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