embedded-test.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. #!/usr/bin/env mksh
  2. #
  3. # Copyright © 2014-2015
  4. # Waldemar Brodkorb <wbx@embedded-test.org>
  5. #
  6. # Provided that these terms and disclaimer and all copyright notices
  7. # are retained or reproduced in an accompanying document, permission
  8. # is granted to deal in this work without restriction, including un‐
  9. # limited rights to use, publicly perform, distribute, sell, modify,
  10. # merge, give away, or sublicence.
  11. #
  12. # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
  13. # the utmost extent permitted by applicable law, neither express nor
  14. # implied; without malicious intent or gross negligence. In no event
  15. # may a licensor, author or contributor be held liable for indirect,
  16. # direct, other damage, loss, or other issues arising in any way out
  17. # of dealing in the work, even if advised of the possibility of such
  18. # damage or existence of a defect, except proven that it results out
  19. # of said person’s immediate fault when using the work as intended.
  20. #
  21. # Alternatively, this work may be distributed under the Terms of the
  22. # General Public License, any version as published by the Free Soft‐
  23. # ware Foundation.
  24. # architecture specific notes:
  25. # sheb network card get no ip
  26. # m68k glibc toolchain building is broken at the moment
  27. # uClibc-ng
  28. arch_list_uclibcng="armv5 armv7 armeb arcv1 arcv2 arcv1-be arcv2-be avr32 bfin c6x crisv10 crisv32 h8300 m68k m68k-nommu microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 or1k ppc ppcsf sh sheb sparc x86 x86_64 xtensa"
  29. # musl
  30. arch_list_musl="aarch64 armv5 armv7 armeb microblazeel microblazebe mips mipssf mipsel mipselsf or1k ppc sh sheb x86 x86_64"
  31. # glibc
  32. arch_list_glibc="aarch64 armv5 armv7 armeb microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 nios2 ppc ppcsf ppc64 sh sheb sparc sparc64 tile x86 x86_64"
  33. topdir=$(pwd)
  34. giturl=http://git.openadk.org/openadk.git
  35. valid_libc="uclibc-ng musl glibc"
  36. valid_tests="boot libc ltp mksh native"
  37. tools='make git wget xz cpio tar awk sed'
  38. f=0
  39. for tool in $tools; do
  40. if ! which $tool >/dev/null; then
  41. echo "Checking if $tool is installed... failed"
  42. f=1
  43. fi
  44. done
  45. if [ $f -eq 1 ];then exit 1; fi
  46. help() {
  47. cat >&2 <<EOF
  48. Syntax: $0 [ --libc=<libc> --arch=<arch> --tests=<tests> ]
  49. Explanation:
  50. --libc=<libc> c library to use (${valid_libc})
  51. --arch=<arch> architecture to check (otherwise all supported)
  52. --tests=<tests> run tests (${valid_tests})
  53. --source=<dir> use directory with source for C library
  54. --ntp=<ntpserver> set NTP server for test run
  55. --packages=<packagelist> add extra packages to the build
  56. --update update OpenADK source via git pull, before building
  57. --continue continue on a broken build
  58. --clean clean OpenADK build directory before build
  59. --debug enable debug output from OpenADK
  60. --shell start a shell instead auf autorun of test
  61. --help this help text
  62. EOF
  63. exit 1
  64. }
  65. continue=0
  66. clean=0
  67. shell=0
  68. update=0
  69. debug=0
  70. piggyback=0
  71. ntp=""
  72. libc=""
  73. while [[ $1 != -- && $1 = -* ]]; do case $1 {
  74. (--clean) clean=1; shift ;;
  75. (--debug) debug=1; shift ;;
  76. (--update) update=1; shift ;;
  77. (--continue) continue=1; shift ;;
  78. (--shell) shell=1 shift ;;
  79. (--libc=*) libc=${1#*=}; shift ;;
  80. (--arch=*) archs=${1#*=}; shift ;;
  81. (--tests=*) tests=${1#*=}; shift ;;
  82. (--source=*) source=${1#*=}; shift ;;
  83. (--ntp=*) ntp=${1#*=}; shift ;;
  84. (--help) help; shift ;;
  85. (--*) echo "unknown option $1"; exit 1 ;;
  86. (-*) help ;;
  87. }; done
  88. if [ -z "$libc" ];then
  89. libc="uclibc-ng musl glibc"
  90. fi
  91. if [ ! -d openadk ];then
  92. git clone $giturl
  93. if [ $? -ne 0 ];then
  94. echo "Cloning from $giturl failed."
  95. exit 1
  96. fi
  97. else
  98. if [ $update -eq 1 ];then
  99. (cd openadk && git pull)
  100. if [ $? -ne 0 ];then
  101. echo "Updating from $giturl failed."
  102. exit 1
  103. fi
  104. fi
  105. fi
  106. runtest() {
  107. lib=$1
  108. arch=$2
  109. test=$3
  110. emulator=qemu
  111. qemu=qemu-system-${arch}
  112. qemu_args=
  113. if [ $ntp ]; then
  114. qemu_append="-append ntpserver=$ntp"
  115. fi
  116. if [ $shell -eq 1 ]; then
  117. qemu_append="-append shell"
  118. fi
  119. noappend=0
  120. piggyback=0
  121. suffix=
  122. libdir=lib
  123. march=${arch}
  124. case ${arch} in
  125. aarch64)
  126. cpu_arch=aarch64
  127. qemu_machine=virt
  128. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  129. ;;
  130. armv5)
  131. cpu_arch=arm
  132. march=arm-versatilepb
  133. qemu=qemu-system-${cpu_arch}
  134. qemu_machine=versatilepb
  135. suffix=soft_eabi
  136. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  137. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  138. ;;
  139. armv7)
  140. cpu_arch=arm
  141. march=arm-vexpress-a9
  142. qemu=qemu-system-${cpu_arch}
  143. qemu_machine=vexpress-a9
  144. suffix=hard_eabihf
  145. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  146. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  147. ;;
  148. arcv1)
  149. emulator=nsim
  150. cpu_arch=arc
  151. piggyback=1
  152. ;;
  153. arcv2)
  154. emulator=nsim
  155. cpu_arch=arc
  156. piggyback=1
  157. ;;
  158. crisv32)
  159. cpu_arch=crisv32
  160. march=cris
  161. qemu=qemu-system-${march}
  162. qemu_machine=axis-dev88
  163. piggyback=1
  164. ;;
  165. metag)
  166. cpu_arch=metag
  167. march=meta
  168. qemu=qemu-system-${march}
  169. qemu_args="${qemu_args} -display none -device da,exit_threads=1 -chardev stdio,id=chan1 -chardev pty,id=chan2"
  170. piggyback=1
  171. ;;
  172. microblazeel)
  173. cpu_arch=microblazeel
  174. march=microblaze-ml605
  175. qemu_machine=petalogix-s3adsp1800
  176. ;;
  177. microblazebe)
  178. cpu_arch=microblaze
  179. march=microblaze-ml605
  180. qemu=qemu-system-${cpu_arch}
  181. qemu_machine=petalogix-s3adsp1800
  182. ;;
  183. mips)
  184. cpu_arch=mips
  185. qemu=qemu-system-${cpu_arch}
  186. qemu_machine=malta
  187. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  188. suffix=hard
  189. ;;
  190. mipssf)
  191. cpu_arch=mips
  192. march=mips
  193. qemu=qemu-system-${cpu_arch}
  194. qemu_machine=malta
  195. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  196. suffix=soft
  197. ;;
  198. mipsel)
  199. cpu_arch=mipsel
  200. march=mips
  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=hard
  205. ;;
  206. mipselsf)
  207. cpu_arch=mipsel
  208. march=mips
  209. qemu=qemu-system-${cpu_arch}
  210. qemu_machine=malta
  211. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  212. suffix=soft
  213. ;;
  214. mips64)
  215. cpu_arch=mips64
  216. qemu_machine=malta
  217. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  218. suffix=o32
  219. ;;
  220. mips64n32)
  221. cpu_arch=mips64
  222. march=mips64
  223. qemu=qemu-system-${cpu_arch}
  224. qemu_machine=malta
  225. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  226. suffix=n32
  227. ;;
  228. mips64n64)
  229. cpu_arch=mips64
  230. march=mips64
  231. qemu=qemu-system-${cpu_arch}
  232. qemu_machine=malta
  233. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  234. suffix=n64
  235. ;;
  236. mips64el)
  237. cpu_arch=mips64el
  238. march=mips64
  239. qemu_machine=malta
  240. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  241. suffix=o32
  242. ;;
  243. mips64eln32)
  244. cpu_arch=mips64el
  245. march=mips64
  246. qemu=qemu-system-${cpu_arch}
  247. qemu_machine=malta
  248. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  249. suffix=n32
  250. ;;
  251. mips64eln64)
  252. cpu_arch=mips64el
  253. march=mips64
  254. qemu=qemu-system-${cpu_arch}
  255. qemu_machine=malta
  256. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  257. suffix=n64
  258. ;;
  259. ppcsf)
  260. cpu_arch=ppc
  261. march=ppc-bamboo
  262. qemu=qemu-system-${cpu_arch}
  263. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  264. qemu_machine=bamboo
  265. suffix=soft
  266. ;;
  267. ppc)
  268. cpu_arch=ppc
  269. march=ppc-macppc
  270. qemu=qemu-system-${cpu_arch}
  271. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  272. qemu_machine=mac99
  273. suffix=hard
  274. noappend=1
  275. ;;
  276. powerpc64|ppc64)
  277. cpu_arch=ppc64
  278. qemu=qemu-system-${cpu_arch}
  279. qemu_machine=pseries
  280. ;;
  281. sh)
  282. cpu_arch=sh4
  283. qemu=qemu-system-${cpu_arch}
  284. qemu_machine=r2d
  285. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  286. ;;
  287. sheb)
  288. cpu_arch=sh4eb
  289. march=sh
  290. qemu=qemu-system-${cpu_arch}
  291. qemu_machine=r2d
  292. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  293. ;;
  294. sparc)
  295. cpu_arch=sparc
  296. qemu_machine=SS-5
  297. ;;
  298. sparc64)
  299. cpu_arch=sparc64
  300. qemu_machine=sun4u
  301. qemu_args="${qemu_args} -net nic,model=e1000 -net user"
  302. ;;
  303. x86)
  304. cpu_arch=i686
  305. qemu=qemu-system-i386
  306. qemu_machine=pc
  307. qemu_args="${qemu_args}"
  308. ;;
  309. x86_64)
  310. cpu_arch=x86_64
  311. qemu_machine=pc
  312. libdir=lib64
  313. ;;
  314. x86_64_x32)
  315. cpu_arch=x86_64
  316. qemu=qemu-system-${cpu_arch}
  317. qemu_machine=pc
  318. libdir=libx32
  319. ;;
  320. xtensa)
  321. cpu_arch=xtensa
  322. qemu=qemu-system-${cpu_arch}
  323. qemu_machine=lx60
  324. qemu_args="${qemu_args} -cpu dc233c"
  325. ;;
  326. *)
  327. echo "architecture ${arch} not supported"; exit 1;;
  328. esac
  329. case $emulator in
  330. qemu)
  331. echo "Using QEMU as emulator"
  332. if ! which $qemu >/dev/null; then
  333. echo "Checking if $qemu is installed... failed"
  334. exit 1
  335. fi
  336. qemuver=$(${qemu} -version|awk '{ print $4 }')
  337. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  338. echo "Your qemu version is too old. Please update to 2.1 or greater"
  339. exit 1
  340. fi
  341. ;;
  342. nsim)
  343. echo "Using Synopsys NSIM as simulator"
  344. if ! which nsimdrv >/dev/null; then
  345. echo "Checking if $emulator is installed... failed"
  346. exit 1
  347. fi
  348. ;;
  349. *)
  350. echo "emulator/simulator not supported"; exit 1;;
  351. esac
  352. echo "Starting test for $lib and $arch"
  353. # check if initramfs or piggyback is used
  354. if [ $piggyback -eq 1 ]; then
  355. echo "Using extra directory for test image creation"
  356. root=openadk/extra
  357. rm -rf openadk/extra 2>/dev/null
  358. mkdir openadk/extra 2>/dev/null
  359. if [ ! -z $suffix ]; then
  360. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  361. else
  362. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  363. fi
  364. else
  365. echo "Generating root filesystem for test run"
  366. root=$(mktemp -d /tmp/XXXX)
  367. if [ ! -z $suffix ]; then
  368. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  369. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  370. else
  371. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  372. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  373. fi
  374. if [ ! -f $archive ];then
  375. echo "No root filesystem available for architecture ${arch} tried $archive"
  376. exit 1
  377. fi
  378. tar -xf $archive -C $root
  379. fi
  380. # creating test script to be run on boot
  381. cat > ${root}/run.sh << EOF
  382. #!/bin/sh
  383. uname -a
  384. if [ \$ntpserver ]; then
  385. rdate \$ntpserver
  386. else
  387. rdate time.fu-berlin.de
  388. fi
  389. EOF
  390. if [ $test = "boot" ];then
  391. cat >> ${root}/run.sh << EOF
  392. file /bin/busybox
  393. size /bin/busybox
  394. for i in \$(ls /lib/*.so|grep -v libgcc);do
  395. size \$i
  396. done
  397. exit
  398. EOF
  399. fi
  400. if [ $test = "ltp" ];then
  401. cat >> ${root}/run.sh << EOF
  402. /opt/ltp/runltp
  403. exit
  404. EOF
  405. fi
  406. if [ $test = "mksh" ];then
  407. cat >> ${root}/run.sh << EOF
  408. mksh /opt/mksh/test.sh
  409. exit
  410. EOF
  411. fi
  412. if [ $test = "libc" ];then
  413. case $lib in
  414. uclibc-ng)
  415. cat >> ${root}/run.sh << EOF
  416. cd /opt/uclibc-ng/test
  417. sh ./uclibcng-testrunner.sh
  418. exit
  419. EOF
  420. ;;
  421. musl|glibc)
  422. cat >> ${root}/run.sh << EOF
  423. cd /opt/libc-test
  424. CC=: make run
  425. exit
  426. EOF
  427. ;;
  428. esac
  429. fi
  430. chmod u+x ${root}/run.sh
  431. if [ $piggyback -eq 1 ]; then
  432. (cd openadk && make v)
  433. else
  434. echo "Creating initramfs filesystem"
  435. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  436. rm -rf $root
  437. qemu_args="$qemu_args -initrd initramfs.${arch}"
  438. fi
  439. # qemu-ppc overwrites existing commandline
  440. if [ $noappend -eq 0 ]; then
  441. qemu_args="$qemu_args ${qemu_append}"
  442. fi
  443. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  444. case $emulator in
  445. qemu)
  446. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic"
  447. ${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic | tee REPORT.${arch}.${test}.${libver}
  448. ;;
  449. nsim)
  450. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  451. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  452. ;;
  453. esac
  454. if [ $? -eq 0 ];then
  455. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  456. echo
  457. else
  458. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  459. echo
  460. fi
  461. }
  462. compile() {
  463. rm .config* .defconfig 2>/dev/null
  464. make $1 defconfig
  465. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  466. make $1 all
  467. }
  468. build() {
  469. lib=$1
  470. arch=$2
  471. test=$3
  472. cd openadk
  473. make prereq
  474. make package=$lib clean > /dev/null 2>&1
  475. DEFAULT="ADK_TARGET_LIBC=$lib"
  476. if [ $debug -eq 1 ];then
  477. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  478. fi
  479. if [ $test = "boot" ];then
  480. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  481. fi
  482. if [ $test = "ltp" ];then
  483. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  484. fi
  485. if [ $test = "mksh" ];then
  486. DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
  487. fi
  488. if [ $test = "libc" ];then
  489. case $lib in
  490. uclibc-ng)
  491. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  492. ;;
  493. glibc)
  494. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  495. ;;
  496. musl)
  497. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  498. ;;
  499. esac
  500. fi
  501. if [ $test = "native" ];then
  502. case $lib in
  503. uclibc-ng)
  504. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  505. ;;
  506. musl)
  507. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  508. ;;
  509. glibc)
  510. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  511. ;;
  512. esac
  513. fi
  514. case $arch in
  515. aarch64)
  516. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  517. compile "$DEFAULT"
  518. ;;
  519. arcv1)
  520. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  521. compile "$DEFAULT"
  522. ;;
  523. arcv2)
  524. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  525. compile "$DEFAULT"
  526. ;;
  527. arcv1-be)
  528. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  529. compile "$DEFAULT"
  530. ;;
  531. arcv2-be)
  532. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  533. compile "$DEFAULT"
  534. ;;
  535. armv5)
  536. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  537. compile "$DEFAULT"
  538. ;;
  539. armeb)
  540. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  541. compile "$DEFAULT"
  542. ;;
  543. armv7)
  544. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  545. compile "$DEFAULT"
  546. ;;
  547. avr32)
  548. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  549. compile "$DEFAULT"
  550. ;;
  551. bfin)
  552. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  553. compile "$DEFAULT"
  554. ;;
  555. c6x)
  556. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  557. compile "$DEFAULT"
  558. ;;
  559. crisv10)
  560. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  561. compile "$DEFAULT"
  562. ;;
  563. crisv32)
  564. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  565. compile "$DEFAULT"
  566. ;;
  567. h8300)
  568. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  569. compile "$DEFAULT"
  570. ;;
  571. m68k)
  572. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  573. compile "$DEFAULT"
  574. ;;
  575. m68k-nommu)
  576. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  577. compile "$DEFAULT"
  578. ;;
  579. metag)
  580. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-metag"
  581. compile "$DEFAULT"
  582. ;;
  583. microblazebe)
  584. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  585. compile "$DEFAULT"
  586. ;;
  587. microblazeel)
  588. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  589. compile "$DEFAULT"
  590. ;;
  591. mips)
  592. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard"
  593. compile "$DEFAULT"
  594. ;;
  595. mipssf)
  596. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft"
  597. compile "$DEFAULT"
  598. ;;
  599. mipsel)
  600. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard"
  601. compile "$DEFAULT"
  602. ;;
  603. mipselsf)
  604. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft"
  605. compile "$DEFAULT"
  606. ;;
  607. mips64)
  608. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  609. compile "$DEFAULT"
  610. ;;
  611. mips64n32)
  612. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  613. compile "$DEFAULT"
  614. ;;
  615. mips64n64)
  616. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  617. compile "$DEFAULT"
  618. ;;
  619. mips64el)
  620. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  621. compile "$DEFAULT"
  622. ;;
  623. mips64eln32)
  624. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  625. compile "$DEFAULT"
  626. ;;
  627. mips64eln64)
  628. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  629. compile "$DEFAULT"
  630. ;;
  631. nios2)
  632. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  633. compile "$DEFAULT"
  634. ;;
  635. or1k)
  636. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  637. compile "$DEFAULT"
  638. ;;
  639. ppc)
  640. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  641. compile "$DEFAULT"
  642. ;;
  643. ppcsf)
  644. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  645. compile "$DEFAULT"
  646. ;;
  647. ppc64)
  648. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  649. compile "$DEFAULT"
  650. ;;
  651. sh)
  652. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  653. compile "$DEFAULT"
  654. ;;
  655. sheb)
  656. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  657. compile "$DEFAULT"
  658. ;;
  659. tile)
  660. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  661. compile "$DEFAULT"
  662. ;;
  663. *)
  664. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  665. compile "$DEFAULT"
  666. ;;
  667. esac
  668. if [ $? -ne 0 ];then
  669. echo "build failed"
  670. exit 1
  671. fi
  672. cd ..
  673. }
  674. for lib in ${libc}; do
  675. case $lib in
  676. uclibc-ng)
  677. archlist=$arch_list_uclibcng
  678. version=1.0.9
  679. libver=uClibc-ng-${version}
  680. libdir=uClibc-ng
  681. ;;
  682. glibc)
  683. archlist=$arch_list_glibc
  684. version=2.22
  685. libver=glibc-${version}
  686. libdir=glibc
  687. ;;
  688. musl)
  689. archlist=$arch_list_musl
  690. version=1.1.11
  691. libver=musl-${version}
  692. libdir=musl
  693. ;;
  694. *)
  695. echo "$lib not supported"
  696. exit 1
  697. ;;
  698. esac
  699. if [ ! -z $archs ]; then
  700. archlist="$archs"
  701. fi
  702. if [ ! -z $source ]; then
  703. if [ ! -d $source ]; then
  704. echo "Not a directory."
  705. exit 1
  706. fi
  707. usrc=$(mktemp -d /tmp/XXXX)
  708. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  709. cp -a $source $usrc/$libver
  710. mkdir -p $topdir/openadk/dl 2>/dev/null
  711. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  712. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  713. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  714. fi
  715. # start with a clean dir
  716. if [ $clean -eq 1 ]; then
  717. echo "cleaning openadk build directory"
  718. (cd openadk && make cleandir)
  719. fi
  720. if [ ! -z "$tests" ];then
  721. testinfo="$tests testing"
  722. else
  723. testinfo="toolchain testing"
  724. fi
  725. echo "Summary: testing $archlist with C library $lib and $testinfo"
  726. sleep 2
  727. for arch in ${archlist}; do
  728. if [ $continue -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" ]; then
  729. echo "Skipping this test after last build break"
  730. continue
  731. fi
  732. echo "Compiling base system and toolchain for $lib and $arch"
  733. build $lib $arch notest
  734. if [ ! -z "$tests" ];then
  735. for test in ${tests}; do
  736. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" -o $test = "mksh" ];then
  737. case $lib in
  738. uclibc-ng)
  739. case $arch in
  740. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  741. echo "runtime tests disabled for $arch."
  742. ;;
  743. *)
  744. build $lib $arch $test
  745. runtest $lib $arch $test
  746. ;;
  747. esac
  748. ;;
  749. musl)
  750. case $arch in
  751. armeb|or1k|sheb)
  752. echo "runtime tests disabled for $arch."
  753. ;;
  754. *)
  755. build $lib $arch $test
  756. runtest $lib $arch $test
  757. ;;
  758. esac
  759. ;;
  760. glibc)
  761. case $arch in
  762. armeb|m68k|nios2|sheb|tile)
  763. echo "runtime tests disabled for $arch."
  764. ;;
  765. *)
  766. build $lib $arch $test
  767. runtest $lib $arch $test
  768. ;;
  769. esac
  770. ;;
  771. esac
  772. else
  773. echo "Test $test is not valid. Allowed tests: $valid_tests"
  774. exit 1
  775. fi
  776. done
  777. fi
  778. done
  779. done
  780. echo "All tests finished."
  781. exit 0