glibc-testing.inc 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. do_compile_append () {
  2. # now generate script to drive testing
  3. echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testglibc
  4. set >> ${B}/${HOST_PREFIX}testglibc
  5. # prune out the unneeded vars
  6. sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testglibc
  7. sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testglibc
  8. sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testglibc
  9. sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testglibc
  10. sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testglibc
  11. sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testglibc
  12. sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testglibc
  13. sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testglibc
  14. sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testglibc
  15. sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testglibc
  16. sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testglibc
  17. sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testglibc
  18. sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testglibc
  19. sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testglibc
  20. sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testglibc
  21. sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testglibc
  22. sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testglibc
  23. sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testglibc
  24. sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testglibc
  25. sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testglibc
  26. sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testglibc
  27. sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testglibc
  28. sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testglibc
  29. sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testglibc
  30. sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testglibc
  31. sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testglibc
  32. sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testglibc
  33. sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testglibc
  34. # point to real sysroot not the toolchain bootstrap sysroot
  35. sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testglibc
  36. # use the final cross-gcc to test since some tests need libstdc++
  37. sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testglibc
  38. # append execution part script
  39. cat >> ${B}/${HOST_PREFIX}testglibc << STOP
  40. target="\$1"
  41. if [ "x\$target" = "x" ]
  42. then
  43. echo "Please specify the target machine and remote user in form of user@target"
  44. exit 1;
  45. fi
  46. ssh \$target ls \$PWD\ 2>&1 > /dev/null
  47. if [ "x\$?" != "x0" ]
  48. then
  49. echo "Failed connecting to \$target it could be because of:"
  50. echo "1. You dont have passwordless ssh setup to access \$target"
  51. echo "2. NFS share on \$target is not mounted or if mounted then not matching the build tree layout."
  52. echo " The tree should be accessible at same location on build host and target"
  53. echo " You can add nfs-client to IMAGE_FEATURES to get the nfs client on target"
  54. echo "3. nfs server on build host is not running."
  55. echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want"
  56. echo " to test as root user on target (usually its recommended to create a non"
  57. echo " root user."
  58. echo " As a sanity check make sure that target can read/write to the glibc build tree"
  59. echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup"
  60. exit 1
  61. fi
  62. echo "# we test using cross compiler from real sysroot therefore override the" > ${B}/configparms
  63. echo "# definitions that come from ${B}/config.make" >> ${B}/configparms
  64. fgrep tcbootstrap ${B}/config.make > ${B}/configparms
  65. sed -i -e "s/\-tcbootstrap//g" ${B}/configparms
  66. # g++ uses flag -nostdinc, so the locations of system include headers must be explicitly specified
  67. # If the locations are not already specified in config.make, then we provide the following locations:
  68. # <sysroot>/usr/include/c++/<g++ version>
  69. # <sysroot>/usr/include/c++/<g++ version>/<machine>
  70. cxxincludes=\`cat ${B}/config.make | gawk '\$1 == "c++-sysincludes"' | gawk -F"=" '{print \$2}' | sed "s/[ \t]\?//g"\`
  71. if [ -z "\$cxxincludes" ]; then
  72. sysroot=\`cat ${B}/configparms | sed -n "/CXX/p" | sed -e "s/^.*--sysroot=//"\`
  73. cxx=\`cat ${B}/configparms | gawk '\$1 ~ /^CXX/' | gawk -F"=" '{print \$2}' | gawk '{print \$1}'\`
  74. cxxmachine=\`\$cxx -dumpmachine\`
  75. cxxversion=\`\$cxx -dumpversion\`
  76. # pass the new value of c++-sysincludes via configparms
  77. echo "# c++-sysincludes added:" >> ${B}/configparms
  78. echo "c++-sysincludes = -isystem \$sysroot/usr/include/c++/\$cxxversion -isystem \$sysroot/usr/include/c++/\$cxxversion/\$cxxmachine" >> ${B}/configparms
  79. fi
  80. wrapper="${S}/scripts/cross-test-ssh.sh \$target"
  81. localedef="${STAGING_BINDIR_NATIVE}/cross-localedef --little-endian --uint32-align=4"
  82. make tests-clean
  83. make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check
  84. rm -rf ${B}/configparms
  85. STOP
  86. chmod +x ${B}/${HOST_PREFIX}testglibc
  87. }