embedded-test.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. #!/bin/sh
  2. # Copyright © 2014
  3. # Waldemar Brodkorb <wbx@openadk.org>
  4. #
  5. # Provided that these terms and disclaimer and all copyright notices
  6. # are retained or reproduced in an accompanying document, permission
  7. # is granted to deal in this work without restriction, including un‐
  8. # limited rights to use, publicly perform, distribute, sell, modify,
  9. # merge, give away, or sublicence.
  10. #
  11. # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
  12. # the utmost extent permitted by applicable law, neither express nor
  13. # implied; without malicious intent or gross negligence. In no event
  14. # may a licensor, author or contributor be held liable for indirect,
  15. # direct, other damage, loss, or other issues arising in any way out
  16. # of dealing in the work, even if advised of the possibility of such
  17. # damage or existence of a defect, except proven that it results out
  18. # of said person’s immediate fault when using the work as intended.
  19. #
  20. # Alternatively, this work may be distributed under the Terms of the
  21. # General Public License, any version as published by the Free Soft‐
  22. # ware Foundation.
  23. # architecture specific notes:
  24. # mips64n32/mips64eln32 produces segfaults on boot for uClibc/uClibc-ng
  25. # sheb network card get no ip
  26. arch_list_uclibcng="arm armhf arc arcbe avr32 bfin cris m68k m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64 xtensa"
  27. arch_list_uclibc="arm armhf arc arcbe bfin m68k mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64"
  28. arch_list_musl="arm armhf mips mipsel ppc-nofpu sh sheb x86 x86_64"
  29. arch_list_glibc="aarch64 arm armhf m68k mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 ppc-nofpu ppc64 sh sheb sparc sparc64 tile x86 x86_64"
  30. topdir=$(pwd)
  31. openadk_git=http://git.openadk.org/openadk.git
  32. tools='make git wget xz cpio tar awk sed'
  33. f=0
  34. for tool in $tools; do
  35. if ! which $tool >/dev/null; then
  36. echo "Checking if $tool is installed... failed"
  37. f=1
  38. fi
  39. done
  40. if [ $f -eq 1 ];then exit 1; fi
  41. help() {
  42. cat >&2 <<EOF
  43. Syntax: $0 [ -l <libc> -a <arch> -t <tests> ]
  44. Explanation:
  45. -l: c library to use (uclibc-ng|musl|glibc|uclibc)
  46. -g: use latest git version of C library
  47. -a: architecture to check (otherwise all supported)
  48. -u: update openadk source via git pull, before building
  49. -s: use directory with source for C library
  50. -d: enable debug output from OpenADK
  51. -c: clean OpenADK build directory before build
  52. -n: set NTP server for test run
  53. -t: run tests (boot|libc|ltp|native)
  54. -p: add extra packages to build
  55. -r: rebuild C library
  56. -m: start a shell in Qemu system for manual testing
  57. -h: help text
  58. EOF
  59. }
  60. clean=0
  61. shell=0
  62. update=0
  63. debug=0
  64. git=0
  65. rebuild=0
  66. ntp=time.fu-berlin.de
  67. while getopts "hgrumdcn:a:s:l:t:p:" ch; do
  68. case $ch in
  69. m)
  70. shell=1
  71. ;;
  72. g)
  73. git=1
  74. ;;
  75. c)
  76. clean=1
  77. ;;
  78. d)
  79. debug=1
  80. ;;
  81. u)
  82. update=1
  83. ;;
  84. r)
  85. rebuild=1
  86. ;;
  87. s)
  88. source=$OPTARG
  89. ;;
  90. l)
  91. libc=$OPTARG
  92. ;;
  93. n)
  94. ntp=$OPTARG
  95. ;;
  96. a)
  97. archtolist=$OPTARG
  98. ;;
  99. p)
  100. pkgs=$OPTARG
  101. ;;
  102. t)
  103. tests=$OPTARG
  104. ;;
  105. h)
  106. help
  107. exit 1
  108. ;;
  109. esac
  110. done
  111. shift $((OPTIND - 1))
  112. if [ -z "$libc" ];then
  113. libc="uclibc-ng uclibc musl glibc"
  114. fi
  115. if [ ! -d openadk ];then
  116. git clone $openadk_git
  117. if [ $? -ne 0 ];then
  118. echo "Cloning from $openadk_git failed."
  119. exit 1
  120. fi
  121. else
  122. if [ $update -eq 1 ];then
  123. (cd openadk && git pull)
  124. if [ $? -ne 0 ];then
  125. echo "Updating from $openadk_git failed."
  126. exit 1
  127. fi
  128. fi
  129. fi
  130. runtest() {
  131. lib=$1
  132. arch=$2
  133. test=$3
  134. qemu=qemu-system-${arch}
  135. qemu_args=
  136. qemu_append="ntp_server=$ntp"
  137. if [ $debug -eq 0 ];then
  138. qemu_append="$qemu_append quiet"
  139. fi
  140. if [ $shell -eq 1 ];then
  141. qemu_append="$qemu_append shell"
  142. fi
  143. suffix=
  144. psuffix=
  145. libdir=lib
  146. march=${arch}
  147. case ${arch} in
  148. aarch64)
  149. cpu_arch=aarch64
  150. qemu_machine=virt
  151. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  152. ;;
  153. arm)
  154. cpu_arch=arm
  155. qemu_machine=vexpress-a9
  156. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  157. suffix=eabi
  158. psuffix=$suffix
  159. ;;
  160. armhf)
  161. cpu_arch=arm
  162. march=arm
  163. qemu=qemu-system-${cpu_arch}
  164. qemu_machine=vexpress-a9
  165. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  166. suffix=eabihf
  167. psuffix=$suffix
  168. ;;
  169. mips)
  170. cpu_arch=mips
  171. qemu_machine=malta
  172. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  173. ;;
  174. mipsel)
  175. cpu_arch=mipsel
  176. march=mips
  177. qemu_machine=malta
  178. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  179. ;;
  180. mips64)
  181. cpu_arch=mips64
  182. qemu_machine=malta
  183. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  184. suffix=abi32
  185. psuffix=o32
  186. ;;
  187. mips64n32)
  188. cpu_arch=mips64
  189. march=mips64
  190. qemu=qemu-system-${cpu_arch}
  191. qemu_machine=malta
  192. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  193. suffix=abin32
  194. psuffix=n32
  195. ;;
  196. mips64n64)
  197. cpu_arch=mips64
  198. march=mips64
  199. qemu=qemu-system-${cpu_arch}
  200. qemu_machine=malta
  201. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  202. suffix=abi64
  203. psuffix=n64
  204. ;;
  205. mips64el)
  206. cpu_arch=mips64el
  207. march=mips64
  208. qemu_machine=malta
  209. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  210. suffix=abi32
  211. psuffix=o32
  212. ;;
  213. mips64eln32)
  214. cpu_arch=mips64el
  215. march=mips64
  216. qemu=qemu-system-${cpu_arch}
  217. qemu_machine=malta
  218. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  219. suffix=abin32
  220. psuffix=n32
  221. ;;
  222. mips64eln64)
  223. cpu_arch=mips64el
  224. march=mips64
  225. qemu=qemu-system-${cpu_arch}
  226. qemu_machine=malta
  227. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  228. suffix=abi64
  229. psuffix=n64
  230. ;;
  231. ppc-nofpu)
  232. cpu_arch=ppc
  233. march=ppc
  234. qemu=qemu-system-${cpu_arch}
  235. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  236. qemu_machine=bamboo
  237. ;;
  238. ppc)
  239. cpu_arch=ppc
  240. march=ppc
  241. qemu=qemu-system-${cpu_arch}
  242. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  243. qemu_machine=mac99
  244. ;;
  245. powerpc64|ppc64)
  246. cpu_arch=ppc64
  247. qemu=qemu-system-${cpu_arch}
  248. qemu_machine=pseries
  249. ;;
  250. sh)
  251. cpu_arch=sh4
  252. qemu=qemu-system-${cpu_arch}
  253. qemu_machine=r2d
  254. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  255. ;;
  256. sheb)
  257. cpu_arch=sh4eb
  258. march=sh
  259. qemu=qemu-system-${cpu_arch}
  260. qemu_machine=r2d
  261. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  262. ;;
  263. sparc)
  264. cpu_arch=sparc
  265. qemu_machine=SS-5
  266. ;;
  267. sparc64)
  268. cpu_arch=sparc64
  269. qemu_machine=sun4u
  270. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  271. ;;
  272. x86)
  273. cpu_arch=i486
  274. qemu=qemu-system-i386
  275. qemu_machine=pc
  276. qemu_args="${qemu_args}"
  277. ;;
  278. x86_64)
  279. cpu_arch=x86_64
  280. qemu_machine=pc
  281. libdir=lib64
  282. ;;
  283. x86_64_x32)
  284. cpu_arch=x86_64
  285. qemu=qemu-system-${cpu_arch}
  286. qemu_machine=pc
  287. libdir=libx32
  288. suffix=x32
  289. ;;
  290. xtensa)
  291. cpu_arch=xtensa
  292. qemu=qemu-system-${cpu_arch}
  293. qemu_machine=lx60
  294. qemu_args="${qemu_args} -cpu dc233c"
  295. ;;
  296. *)
  297. echo "architecture ${arch} not supported"; exit 1;;
  298. esac
  299. if ! which $qemu >/dev/null; then
  300. echo "Checking if $qemu is installed... failed"
  301. exit 1
  302. fi
  303. qemuver=$(${qemu} -version|awk '{ print $4 }')
  304. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  305. echo "Your qemu version is too old. Please update to 2.1 or greater"
  306. exit 1
  307. fi
  308. echo "Starting test for $lib and ${arch}"
  309. echo "Generating root filesystem for test run"
  310. root=$(mktemp -d /tmp/XXXX)
  311. if [ ! -f openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz ];then
  312. echo "No root filesystem available for architecture ${arch}"
  313. exit 1
  314. fi
  315. tar -xf openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz -C $root
  316. if [ $test = "boot" ];then
  317. cat > ${root}/run.sh << EOF
  318. #!/bin/sh
  319. uname -a
  320. rdate -n \$ntp_server
  321. file /bin/busybox
  322. for i in \$(ls /lib/*.so|grep -v libgcc);do
  323. size \$i
  324. done
  325. exit
  326. EOF
  327. fi
  328. if [ $test = "ltp" ];then
  329. cat > ${root}/run.sh << EOF
  330. #!/bin/sh
  331. uname -a
  332. rdate -n \$ntp_server
  333. /opt/ltp/runltp
  334. exit
  335. EOF
  336. fi
  337. if [ $test = "libc" ];then
  338. case $lib in
  339. uclibc-ng|uclibc)
  340. cat > ${root}/run.sh << EOF
  341. #!/bin/sh
  342. uname -a
  343. rdate -n \$ntp_server
  344. cd /opt/$libc/test
  345. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  346. exit
  347. EOF
  348. ;;
  349. musl|glibc)
  350. cat > ${root}/run.sh << EOF
  351. #!/bin/sh
  352. uname -a
  353. rdate -n \$ntp_server
  354. cd /opt/libc-test
  355. make run
  356. exit
  357. EOF
  358. ;;
  359. esac
  360. fi
  361. chmod u+x ${root}/run.sh
  362. kernel=openadk/firmware/qemu-${march}_${lib}/qemu-${march}-initramfsarchive-kernel
  363. echo "Creating initramfs filesystem"
  364. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  365. rm -rf $root
  366. echo "Now running the tests in qemu for architecture ${arch} and ${lib}"
  367. echo "${qemu} -M ${qemu_machine} ${qemu_args} -append ${qemu_append} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch}"
  368. ${qemu} -M ${qemu_machine} ${qemu_args} -append "${qemu_append}" -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch} | tee REPORT.${arch}.${lib}.${test}.${version}
  369. if [ $? -eq 0 ];then
  370. echo "Test for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  371. echo
  372. else
  373. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  374. echo
  375. fi
  376. }
  377. compile() {
  378. rm .config* .defconfig 2>/dev/null
  379. make $1 defconfig
  380. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  381. make $1 all
  382. }
  383. build() {
  384. lib=$1
  385. arch=$2
  386. test=$3
  387. cd openadk
  388. make prereq
  389. # always trigger regeneration of kernel config
  390. rm build_*_${lib}_${arch}*/linux/.config 2>/dev/null
  391. if [ $rebuild -eq 1 ];then
  392. rm dl/$lib*
  393. make package=$lib clean
  394. fi
  395. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive ADK_TARGET_COLLECTION=test"
  396. if [ $debug -eq 1 ];then
  397. DEFAULT="$DEFAULT VERBOSE=1"
  398. fi
  399. if [ $git -eq 1 ];then
  400. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  401. fi
  402. if [ ! -z $source ];then
  403. DEFAULT="$DEFAULT ADK_NO_CHECKSUM=y"
  404. fi
  405. if [ $test = "boot" ];then
  406. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  407. fi
  408. if [ $test = "ltp" ];then
  409. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  410. fi
  411. if [ $test = "libc" ];then
  412. case $lib in
  413. uclibc-ng)
  414. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  415. ;;
  416. uclibc)
  417. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  418. ;;
  419. glibc)
  420. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  421. ;;
  422. musl)
  423. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  424. ;;
  425. esac
  426. fi
  427. if [ $test = "native" ];then
  428. case $lib in
  429. uclibc-ng)
  430. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  431. ;;
  432. uclibc)
  433. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  434. ;;
  435. musl)
  436. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  437. ;;
  438. glibc)
  439. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  440. ;;
  441. esac
  442. fi
  443. case $arch in
  444. aarch64)
  445. DEFAULT="$DEFAULT ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  446. compile "$DEFAULT"
  447. ;;
  448. arc)
  449. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  450. compile "$DEFAULT"
  451. ;;
  452. arcbe)
  453. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  454. compile "$DEFAULT"
  455. ;;
  456. arm)
  457. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabi ADK_TARGET_ENDIAN=little"
  458. compile "$DEFAULT"
  459. ;;
  460. armhf)
  461. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabihf ADK_TARGET_ENDIAN=little"
  462. compile "$DEFAULT"
  463. ;;
  464. avr32)
  465. DEFAULT="$DEFAULT ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  466. compile "$DEFAULT"
  467. ;;
  468. bfin)
  469. DEFAULT="$DEFAULT ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  470. compile "$DEFAULT"
  471. ;;
  472. cris)
  473. DEFAULT="$DEFAULT ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris"
  474. compile "$DEFAULT"
  475. ;;
  476. m68k)
  477. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  478. compile "$DEFAULT"
  479. ;;
  480. m68k-nommu)
  481. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  482. compile "$DEFAULT"
  483. ;;
  484. mips)
  485. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big"
  486. compile "$DEFAULT"
  487. ;;
  488. mipsel)
  489. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little"
  490. compile "$DEFAULT"
  491. ;;
  492. mips64)
  493. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  494. compile "$DEFAULT"
  495. ;;
  496. mips64n32)
  497. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  498. compile "$DEFAULT"
  499. ;;
  500. mips64n64)
  501. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  502. compile "$DEFAULT"
  503. ;;
  504. mips64el)
  505. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  506. compile "$DEFAULT"
  507. ;;
  508. mips64eln32)
  509. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  510. compile "$DEFAULT"
  511. ;;
  512. mips64eln64)
  513. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  514. compile "$DEFAULT"
  515. ;;
  516. ppc-nofpu)
  517. DEFAULT="$DEFAULT ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc"
  518. compile "$DEFAULT"
  519. ;;
  520. sh)
  521. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  522. compile "$DEFAULT"
  523. ;;
  524. sheb)
  525. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  526. compile "$DEFAULT"
  527. ;;
  528. tile)
  529. DEFAULT="$DEFAULT ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  530. compile "$DEFAULT"
  531. ;;
  532. *)
  533. DEFAULT="$DEFAULT ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  534. compile "$DEFAULT"
  535. ;;
  536. esac
  537. if [ $? -ne 0 ];then
  538. echo "build failed"
  539. exit 1
  540. fi
  541. cd ..
  542. }
  543. for lib in ${libc}; do
  544. case $lib in
  545. uclibc-ng)
  546. archlist=$arch_list_uclibcng
  547. version=1.0.0
  548. gitversion=1.0.0
  549. libver=uClibc-ng-${gitversion}
  550. libdir=uClibc-ng
  551. ;;
  552. uclibc)
  553. archlist=$arch_list_uclibc
  554. version=0.9.33.2
  555. gitversion=0.9.34-git
  556. libver=uClibc-${gitversion}
  557. libdir=uClibc
  558. ;;
  559. glibc)
  560. archlist=$arch_list_glibc
  561. version=2.20
  562. gitversion=2.19.90
  563. libver=glibc-${gitversion}
  564. libdir=glibc
  565. ;;
  566. musl)
  567. archlist=$arch_list_musl
  568. version=1.1.5
  569. gitversion=git
  570. libver=musl-${gitversion}
  571. libdir=musl
  572. ;;
  573. esac
  574. if [ ! -z $archtolist ];then
  575. archlist="$archtolist"
  576. fi
  577. if [ ! -z $source ];then
  578. if [ ! -d $source ];then
  579. echo "Not a directory."
  580. exit 1
  581. fi
  582. git=1
  583. usrc=$(mktemp -d /tmp/XXXX)
  584. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  585. cp -a $source $usrc/$libver
  586. mkdir -p $topdir/openadk/dl 2>/dev/null
  587. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  588. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  589. fi
  590. echo "Architectures to test: $archlist"
  591. for arch in ${archlist}; do
  592. # start with a clean dir
  593. if [ $clean -eq 1 ];then
  594. (cd openadk && make cleandir)
  595. fi
  596. echo "Compiling base system and toolchain for $lib and $arch"
  597. build $lib $arch notest
  598. if [ ! -z "$tests" ];then
  599. for test in ${tests}; do
  600. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  601. case $arch in
  602. arc|arcbe|avr32|bfin|cris|m68k|m68k-nommu|ppc|sheb|mips64eln32|mips64n32|tile)
  603. echo "runtime tests disabled for $arch."
  604. ;;
  605. *)
  606. build $lib $arch $test
  607. runtest $lib $arch $test
  608. ;;
  609. esac
  610. else
  611. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  612. exit 1
  613. fi
  614. done
  615. fi
  616. done
  617. done
  618. echo "All tests finished."
  619. exit 0