embedded-test.sh 18 KB

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