embedded-test.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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 dc232b"
  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. case $lib in
  309. uclibc-ng)
  310. prefix=uclibc
  311. ;;
  312. glibc)
  313. prefix=gnu
  314. ;;
  315. *)
  316. prefix=$libc
  317. ;;
  318. esac
  319. cross=${cpu_arch}-openadk-linux-${prefix}${suffix}
  320. if [ -z $psuffix ];then
  321. TCPATH=${topdir}/openadk/toolchain_qemu-${march}_${lib}_${cpu_arch}
  322. else
  323. TCPATH=${topdir}/openadk/toolchain_qemu-${march}_${lib}_${cpu_arch}_${psuffix}
  324. fi
  325. export PATH="${TCPATH}/usr/bin:$PATH"
  326. if ! which ${cross}-gcc >/dev/null; then
  327. echo "Checking if ${cross}-gcc is installed... failed"
  328. exit 1
  329. fi
  330. echo "Starting test for $lib and ${arch}"
  331. echo "Generating root filesystem for test run"
  332. root=$(mktemp -d /tmp/XXXX)
  333. if [ ! -f openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz ];then
  334. echo "No root filesystem available for architecture ${arch}"
  335. exit 1
  336. fi
  337. tar -xf openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz -C $root
  338. if [ $test = "boot" ];then
  339. cat > ${root}/run.sh << EOF
  340. #!/bin/sh
  341. uname -a
  342. rdate -n \$ntp_server
  343. file /bin/busybox
  344. for i in \$(ls /lib/*.so|grep -v libgcc);do
  345. size \$i
  346. done
  347. exit
  348. EOF
  349. fi
  350. if [ $test = "ltp" ];then
  351. cat > ${root}/run.sh << EOF
  352. #!/bin/sh
  353. uname -a
  354. rdate -n \$ntp_server
  355. /opt/ltp/runltp
  356. exit
  357. EOF
  358. fi
  359. if [ $test = "libc" ];then
  360. case $lib in
  361. uclibc-ng|uclibc)
  362. cat > ${root}/run.sh << EOF
  363. #!/bin/sh
  364. uname -a
  365. rdate -n \$ntp_server
  366. cd /opt/$libc/test
  367. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  368. exit
  369. EOF
  370. ;;
  371. musl|glibc)
  372. cat > ${root}/run.sh << EOF
  373. #!/bin/sh
  374. uname -a
  375. rdate -n \$ntp_server
  376. cd /opt/libc-test
  377. make run
  378. exit
  379. EOF
  380. ;;
  381. esac
  382. fi
  383. chmod u+x ${root}/run.sh
  384. kernel=openadk/firmware/qemu-${march}_${lib}/qemu-${march}-initramfsarchive-kernel
  385. echo "Creating initramfs filesystem"
  386. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  387. rm -rf $root
  388. echo "Now running the tests in qemu for architecture ${arch} and ${lib}"
  389. 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}"
  390. ${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}
  391. if [ $? -eq 0 ];then
  392. echo "Test for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  393. echo
  394. else
  395. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  396. echo
  397. fi
  398. }
  399. compile() {
  400. rm .config* .defconfig 2>/dev/null
  401. make $1 defconfig
  402. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  403. make $1 all
  404. }
  405. build() {
  406. lib=$1
  407. arch=$2
  408. test=$3
  409. cd openadk
  410. make prereq
  411. # always trigger regeneration of kernel config
  412. rm build_*_${lib}_${arch}*/linux/.config 2>/dev/null
  413. if [ $rebuild -eq 1 ];then
  414. rm dl/$lib*
  415. make package=$lib clean
  416. fi
  417. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive ADK_TARGET_COLLECTION=test"
  418. if [ $debug -eq 1 ];then
  419. DEFAULT="$DEFAULT VERBOSE=1"
  420. fi
  421. if [ $git -eq 1 ];then
  422. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  423. fi
  424. if [ ! -z $source ];then
  425. DEFAULT="$DEFAULT ADK_NO_CHECKSUM=y"
  426. fi
  427. if [ $test = "boot" ];then
  428. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  429. fi
  430. if [ $test = "ltp" ];then
  431. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  432. fi
  433. if [ $test = "libc" ];then
  434. case $lib in
  435. uclibc-ng)
  436. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  437. ;;
  438. uclibc)
  439. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  440. ;;
  441. glibc)
  442. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  443. ;;
  444. musl)
  445. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  446. ;;
  447. esac
  448. fi
  449. if [ $test = "native" ];then
  450. case $lib in
  451. uclibc-ng)
  452. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  453. ;;
  454. uclibc)
  455. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  456. ;;
  457. musl)
  458. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  459. ;;
  460. glibc)
  461. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  462. ;;
  463. esac
  464. fi
  465. case $arch in
  466. aarch64)
  467. DEFAULT="$DEFAULT ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  468. compile "$DEFAULT"
  469. ;;
  470. arc)
  471. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  472. compile "$DEFAULT"
  473. ;;
  474. arcbe)
  475. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  476. compile "$DEFAULT"
  477. ;;
  478. arm)
  479. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabi ADK_TARGET_ENDIAN=little"
  480. compile "$DEFAULT"
  481. ;;
  482. armhf)
  483. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabihf ADK_TARGET_ENDIAN=little"
  484. compile "$DEFAULT"
  485. ;;
  486. avr32)
  487. DEFAULT="$DEFAULT ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  488. compile "$DEFAULT"
  489. ;;
  490. bfin)
  491. DEFAULT="$DEFAULT ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  492. compile "$DEFAULT"
  493. ;;
  494. cris)
  495. DEFAULT="$DEFAULT ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris"
  496. compile "$DEFAULT"
  497. ;;
  498. m68k)
  499. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  500. compile "$DEFAULT"
  501. ;;
  502. m68k-nommu)
  503. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  504. compile "$DEFAULT"
  505. ;;
  506. mips)
  507. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big"
  508. compile "$DEFAULT"
  509. ;;
  510. mipsel)
  511. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little"
  512. compile "$DEFAULT"
  513. ;;
  514. mips64)
  515. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  516. compile "$DEFAULT"
  517. ;;
  518. mips64n32)
  519. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  520. compile "$DEFAULT"
  521. ;;
  522. mips64n64)
  523. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  524. compile "$DEFAULT"
  525. ;;
  526. mips64el)
  527. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  528. compile "$DEFAULT"
  529. ;;
  530. mips64eln32)
  531. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  532. compile "$DEFAULT"
  533. ;;
  534. mips64eln64)
  535. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  536. compile "$DEFAULT"
  537. ;;
  538. ppc-nofpu)
  539. DEFAULT="$DEFAULT ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc"
  540. compile "$DEFAULT"
  541. ;;
  542. sh)
  543. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  544. compile "$DEFAULT"
  545. ;;
  546. sheb)
  547. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  548. compile "$DEFAULT"
  549. ;;
  550. tile)
  551. DEFAULT="$DEFAULT ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  552. compile "$DEFAULT"
  553. ;;
  554. *)
  555. DEFAULT="$DEFAULT ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  556. compile "$DEFAULT"
  557. ;;
  558. esac
  559. if [ $? -ne 0 ];then
  560. echo "build failed"
  561. exit 1
  562. fi
  563. cd ..
  564. }
  565. for lib in ${libc}; do
  566. case $lib in
  567. uclibc-ng)
  568. archlist=$arch_list_uclibcng
  569. version=1.0.0
  570. gitversion=1.0.0
  571. libver=uClibc-ng-${gitversion}
  572. libdir=uClibc-ng
  573. ;;
  574. uclibc)
  575. archlist=$arch_list_uclibc
  576. version=0.9.33.2
  577. gitversion=0.9.34-git
  578. libver=uClibc-${gitversion}
  579. libdir=uClibc
  580. ;;
  581. glibc)
  582. archlist=$arch_list_glibc
  583. version=2.20
  584. gitversion=2.19.90
  585. libver=glibc-${gitversion}
  586. libdir=glibc
  587. ;;
  588. musl)
  589. archlist=$arch_list_musl
  590. version=1.1.5
  591. gitversion=git
  592. libver=musl-${gitversion}
  593. libdir=musl
  594. ;;
  595. esac
  596. if [ ! -z $archtolist ];then
  597. archlist="$archtolist"
  598. fi
  599. if [ ! -z $source ];then
  600. if [ ! -d $source ];then
  601. echo "Not a directory."
  602. exit 1
  603. fi
  604. git=1
  605. usrc=$(mktemp -d /tmp/XXXX)
  606. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  607. cp -a $source $usrc/$libver
  608. mkdir -p $topdir/openadk/dl 2>/dev/null
  609. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  610. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  611. fi
  612. echo "Architectures to test: $archlist"
  613. for arch in ${archlist}; do
  614. # start with a clean dir
  615. if [ $clean -eq 1 ];then
  616. (cd openadk && make cleandir)
  617. fi
  618. echo "Compiling base system and toolchain for $lib and $arch"
  619. build $lib $arch notest
  620. if [ ! -z "$tests" ];then
  621. for test in ${tests}; do
  622. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  623. case $arch in
  624. arc|arcbe|avr32|bfin|cris|m68k|m68k-nommu|ppc|sheb|mips64eln32|mips64n32|tile)
  625. echo "runtime tests disabled for $arch."
  626. ;;
  627. *)
  628. build $lib $arch $test
  629. runtest $lib $arch $test
  630. ;;
  631. esac
  632. else
  633. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  634. exit 1
  635. fi
  636. done
  637. fi
  638. done
  639. done
  640. echo "All tests finished."
  641. exit 0