embedded-test.sh 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  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. # uClibc-ng
  25. arch_list_uclibcng="armv5 armv7 armeb arcv1 arcv2 arcv1-be arcv2-be avr32 bfin c6x crisv10 crisv32 m68k m68k-nommu metag microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 or1k ppc ppcsf sh2 sh3 sh4 sh4eb sparc x86 x86_64 xtensa"
  26. # musl
  27. arch_list_musl="aarch64 armv5 armv7 armeb microblazeel microblazebe mips mipssf mipsel mipselsf or1k ppc sh4 sh4eb x86 x86_64"
  28. # glibc
  29. arch_list_glibc="aarch64 armv5 armv7 armeb ia64 microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 nios2 ppc ppcsf ppc64 s390 sh4 sh4eb sparc sparc64 tile x86 x86_64"
  30. # newlib
  31. arch_list_newlib="armv5 armeb bfin crisv10 crisv32 frv lm32 m68k microblazeel mips mipsel or1k ppc sparc x86"
  32. topdir=$(pwd)
  33. giturl=http://git.openadk.org/openadk.git
  34. valid_libc="uclibc-ng musl glibc newlib"
  35. valid_tests="boot libc ltp mksh native"
  36. tools='make git wget xz cpio tar awk sed'
  37. f=0
  38. for tool in $tools; do
  39. if ! which $tool >/dev/null; then
  40. echo "Checking if $tool is installed... failed"
  41. f=1
  42. fi
  43. done
  44. if [ $f -eq 1 ];then exit 1; fi
  45. help() {
  46. cat >&2 <<EOF
  47. Syntax: $0 [ --libc=<libc> --arch=<arch> --tests=<tests> ]
  48. Explanation:
  49. --libc=<libc> c library to use (${valid_libc})
  50. --arch=<arch> architecture to check (otherwise all supported)
  51. --skiparch=<arch> architectures to skip when all choosen
  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. --cleandir clean OpenADK build directories before build
  59. --clean clean OpenADK build directory for single arch
  60. --debug enable debug output from OpenADK
  61. --shell start a shell instead auf autorun of test
  62. --help this help text
  63. EOF
  64. exit 1
  65. }
  66. cont=0
  67. clean=0
  68. cleandir=0
  69. shell=0
  70. update=0
  71. debug=0
  72. piggyback=0
  73. ntp=""
  74. libc=""
  75. while [[ $1 != -- && $1 = -* ]]; do case $1 {
  76. (--cleandir) cleandir=1; shift ;;
  77. (--clean) clean=1; shift ;;
  78. (--debug) debug=1; shift ;;
  79. (--update) update=1; shift ;;
  80. (--continue) cont=1; shift ;;
  81. (--shell) shell=1 shift ;;
  82. (--libc=*) libc=${1#*=}; shift ;;
  83. (--arch=*) archs=${1#*=}; shift ;;
  84. (--skiparch=*) skiparchs=${1#*=}; shift ;;
  85. (--tests=*) tests=${1#*=}; shift ;;
  86. (--source=*) source=${1#*=}; shift ;;
  87. (--packages=*) packages=${1#*=}; shift ;;
  88. (--ntp=*) ntp=${1#*=}; shift ;;
  89. (--help) help; shift ;;
  90. (--*) echo "unknown option $1"; exit 1 ;;
  91. (-*) help ;;
  92. }; done
  93. if [ -z "$libc" ];then
  94. libc="uclibc-ng musl glibc newlib"
  95. fi
  96. if [ ! -d openadk ];then
  97. git clone $giturl
  98. if [ $? -ne 0 ];then
  99. echo "Cloning from $giturl failed."
  100. exit 1
  101. fi
  102. else
  103. if [ $update -eq 1 ];then
  104. (cd openadk && git pull)
  105. if [ $? -ne 0 ];then
  106. echo "Updating from $giturl failed."
  107. exit 1
  108. fi
  109. fi
  110. fi
  111. runtest() {
  112. lib=$1
  113. arch=$2
  114. test=$3
  115. emulator=qemu
  116. qemu=qemu-system-${arch}
  117. qemu_args=-nographic
  118. if [ $ntp ]; then
  119. qemu_append="-append ntpserver=$ntp"
  120. fi
  121. if [ $shell -eq 1 ]; then
  122. qemu_append="-append shell"
  123. fi
  124. noappend=0
  125. piggyback=0
  126. suffix=
  127. libdir=lib
  128. march=${arch}
  129. case ${arch} in
  130. aarch64)
  131. cpu_arch=aarch64
  132. qemu_machine=virt
  133. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  134. ;;
  135. armv5)
  136. cpu_arch=arm
  137. march=arm-versatilepb
  138. qemu=qemu-system-${cpu_arch}
  139. qemu_machine=versatilepb
  140. suffix=soft_eabi
  141. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  142. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  143. ;;
  144. armv7)
  145. cpu_arch=arm
  146. march=arm-vexpress-a9
  147. qemu=qemu-system-${cpu_arch}
  148. qemu_machine=vexpress-a9
  149. suffix=hard_eabihf
  150. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  151. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  152. ;;
  153. arcv1|arcv2)
  154. emulator=nsim
  155. cpu_arch=arc
  156. piggyback=1
  157. ;;
  158. arcv1-be)
  159. emulator=nsim
  160. cpu_arch=arceb
  161. march=arcv1
  162. piggyback=1
  163. ;;
  164. arcv2-be)
  165. emulator=nsim
  166. cpu_arch=arceb
  167. march=arcv2
  168. piggyback=1
  169. ;;
  170. crisv32)
  171. cpu_arch=crisv32
  172. march=cris
  173. qemu=qemu-system-${march}
  174. qemu_machine=axis-dev88
  175. piggyback=1
  176. ;;
  177. metag)
  178. cpu_arch=metag
  179. qemu=qemu-system-meta
  180. qemu_args="-display none -device da,exit_threads=1 -chardev stdio,id=chan1 -chardev pty,id=chan2"
  181. qemu_machine=01sp
  182. piggyback=1
  183. ;;
  184. microblazeel)
  185. cpu_arch=microblazeel
  186. march=microblaze-ml605
  187. qemu_machine=petalogix-s3adsp1800
  188. ;;
  189. microblazebe)
  190. cpu_arch=microblaze
  191. march=microblaze-ml605
  192. qemu=qemu-system-${cpu_arch}
  193. qemu_machine=petalogix-s3adsp1800
  194. ;;
  195. mips)
  196. cpu_arch=mips
  197. qemu=qemu-system-${cpu_arch}
  198. qemu_machine=malta
  199. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  200. suffix=hard
  201. ;;
  202. mipssf)
  203. cpu_arch=mips
  204. march=mips
  205. qemu=qemu-system-${cpu_arch}
  206. qemu_machine=malta
  207. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  208. suffix=soft
  209. ;;
  210. mipsel)
  211. cpu_arch=mipsel
  212. march=mips
  213. qemu=qemu-system-${cpu_arch}
  214. qemu_machine=malta
  215. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  216. suffix=hard
  217. ;;
  218. mipselsf)
  219. cpu_arch=mipsel
  220. march=mips
  221. qemu=qemu-system-${cpu_arch}
  222. qemu_machine=malta
  223. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  224. suffix=soft
  225. ;;
  226. mips64)
  227. cpu_arch=mips64
  228. qemu_machine=malta
  229. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  230. suffix=o32
  231. ;;
  232. mips64n32)
  233. cpu_arch=mips64
  234. march=mips64
  235. qemu=qemu-system-${cpu_arch}
  236. qemu_machine=malta
  237. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  238. suffix=n32
  239. ;;
  240. mips64n64)
  241. cpu_arch=mips64
  242. march=mips64
  243. qemu=qemu-system-${cpu_arch}
  244. qemu_machine=malta
  245. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  246. suffix=n64
  247. ;;
  248. mips64el)
  249. cpu_arch=mips64el
  250. march=mips64
  251. qemu_machine=malta
  252. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  253. suffix=o32
  254. ;;
  255. mips64eln32)
  256. cpu_arch=mips64el
  257. march=mips64
  258. qemu=qemu-system-${cpu_arch}
  259. qemu_machine=malta
  260. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  261. suffix=n32
  262. ;;
  263. mips64eln64)
  264. cpu_arch=mips64el
  265. march=mips64
  266. qemu=qemu-system-${cpu_arch}
  267. qemu_machine=malta
  268. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  269. suffix=n64
  270. ;;
  271. ppcsf)
  272. cpu_arch=ppc
  273. march=ppc-bamboo
  274. qemu=qemu-system-${cpu_arch}
  275. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  276. qemu_machine=bamboo
  277. suffix=soft
  278. ;;
  279. ppc)
  280. cpu_arch=ppc
  281. march=ppc-macppc
  282. qemu=qemu-system-${cpu_arch}
  283. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  284. qemu_machine=mac99
  285. suffix=hard
  286. noappend=1
  287. ;;
  288. ppc64)
  289. cpu_arch=ppc64
  290. qemu=qemu-system-${cpu_arch}
  291. qemu_machine=pseries
  292. ;;
  293. s390)
  294. cpu_arch=s390x
  295. qemu=qemu-system-${cpu_arch}
  296. qemu_machine=s390-ccw-virtio-2.4
  297. ;;
  298. sh4)
  299. cpu_arch=sh4
  300. march=sh
  301. qemu=qemu-system-${cpu_arch}
  302. qemu_machine=r2d
  303. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  304. ;;
  305. sh4eb)
  306. cpu_arch=sh4eb
  307. march=sh
  308. qemu=qemu-system-${cpu_arch}
  309. qemu_machine=r2d
  310. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  311. ;;
  312. sparc)
  313. cpu_arch=sparc
  314. qemu_machine=SS-5
  315. ;;
  316. sparc64)
  317. cpu_arch=sparc64
  318. qemu_machine=sun4u
  319. qemu_args="${qemu_args} -net nic,model=e1000 -net user"
  320. ;;
  321. x86)
  322. cpu_arch=i686
  323. qemu=qemu-system-i386
  324. qemu_machine=pc
  325. qemu_args="${qemu_args}"
  326. ;;
  327. x86_64)
  328. cpu_arch=x86_64
  329. qemu_machine=pc
  330. libdir=lib64
  331. ;;
  332. x86_64_x32)
  333. cpu_arch=x86_64
  334. qemu=qemu-system-${cpu_arch}
  335. qemu_machine=pc
  336. libdir=libx32
  337. ;;
  338. xtensa)
  339. cpu_arch=xtensa
  340. qemu=qemu-system-${cpu_arch}
  341. qemu_machine=lx60
  342. qemu_args="${qemu_args} -cpu dc233c"
  343. ;;
  344. *)
  345. echo "architecture ${arch} not supported"; exit 1;;
  346. esac
  347. case $emulator in
  348. qemu)
  349. echo "Using QEMU as emulator"
  350. if ! which $qemu >/dev/null; then
  351. echo "Checking if $qemu is installed... failed"
  352. exit 1
  353. fi
  354. qemuver=$(${qemu} -version|awk '{ print $4 }')
  355. if [ "$arch" != "metag" ]; then
  356. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  357. echo "Your qemu version is too old. Please update to 2.1 or greater"
  358. exit 1
  359. fi
  360. fi
  361. ;;
  362. nsim)
  363. echo "Using Synopsys NSIM as simulator"
  364. if ! which nsimdrv >/dev/null; then
  365. echo "Checking if $emulator is installed... failed"
  366. exit 1
  367. fi
  368. ;;
  369. *)
  370. echo "emulator/simulator not supported"; exit 1;;
  371. esac
  372. echo "Starting test for $lib and $arch"
  373. # check if initramfs or piggyback is used
  374. if [ $piggyback -eq 1 ]; then
  375. echo "Using extra directory for test image creation"
  376. root=openadk/extra
  377. rm -rf openadk/extra 2>/dev/null
  378. mkdir openadk/extra 2>/dev/null
  379. if [ ! -z $suffix ]; then
  380. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  381. else
  382. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  383. fi
  384. else
  385. echo "Generating root filesystem for test run"
  386. root=$(mktemp -d /tmp/XXXX)
  387. if [ ! -z $suffix ]; then
  388. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  389. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  390. else
  391. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  392. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  393. fi
  394. if [ ! -f $archive ];then
  395. echo "No root filesystem available for architecture ${arch} tried $archive"
  396. exit 1
  397. fi
  398. tar -xf $archive -C $root
  399. fi
  400. # creating test script to be run on boot
  401. cat > ${root}/run.sh << EOF
  402. #!/bin/sh
  403. uname -a
  404. if [ \$ntpserver ]; then
  405. rdate \$ntpserver
  406. else
  407. rdate time.fu-berlin.de
  408. fi
  409. EOF
  410. if [ $test = "boot" ];then
  411. cat >> ${root}/run.sh << EOF
  412. file /bin/busybox
  413. size /bin/busybox
  414. for i in \$(ls /lib/*.so|grep -v libgcc);do
  415. size \$i
  416. done
  417. exit
  418. EOF
  419. fi
  420. if [ $test = "ltp" ];then
  421. cat >> ${root}/run.sh << EOF
  422. /opt/ltp/runltp
  423. exit
  424. EOF
  425. fi
  426. if [ $test = "mksh" ];then
  427. cat >> ${root}/run.sh << EOF
  428. mksh /opt/mksh/test.sh
  429. exit
  430. EOF
  431. fi
  432. if [ $test = "libc" ];then
  433. case $lib in
  434. uclibc-ng)
  435. cat >> ${root}/run.sh << EOF
  436. cd /opt/uclibc-ng/test
  437. sh ./uclibcng-testrunner.sh
  438. exit
  439. EOF
  440. ;;
  441. musl|glibc)
  442. cat >> ${root}/run.sh << EOF
  443. cd /opt/libc-test
  444. CC=: make run
  445. exit
  446. EOF
  447. ;;
  448. esac
  449. fi
  450. chmod u+x ${root}/run.sh
  451. if [ $piggyback -eq 1 ]; then
  452. (cd openadk && make v)
  453. else
  454. echo "Creating initramfs filesystem"
  455. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  456. rm -rf $root
  457. qemu_args="$qemu_args -initrd initramfs.${arch}"
  458. fi
  459. # qemu-ppc overwrites existing commandline
  460. if [ $noappend -eq 0 ]; then
  461. qemu_args="$qemu_args ${qemu_append}"
  462. fi
  463. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  464. case $emulator in
  465. qemu)
  466. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot"
  467. ${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot | tee REPORT.${arch}.${test}.${libver}
  468. ;;
  469. nsim)
  470. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  471. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  472. ;;
  473. esac
  474. if [ $? -eq 0 ];then
  475. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  476. echo
  477. else
  478. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  479. echo
  480. fi
  481. }
  482. compile() {
  483. rm .config* .defconfig 2>/dev/null
  484. make $1 defconfig
  485. for pkg in $packages; do
  486. p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config
  487. yes|make oldconfig
  488. done
  489. # rebuild uClibc-ng package to get test-suite
  490. if [ "$lib" = "uclibc-ng" ]; then
  491. make package=$lib clean
  492. fi
  493. make $1 all
  494. }
  495. build() {
  496. lib=$1
  497. arch=$2
  498. test=$3
  499. cd openadk
  500. make prereq
  501. DEFAULT="ADK_TARGET_LIBC=$lib"
  502. if [ $debug -eq 1 ];then
  503. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  504. fi
  505. if [ $test = "boot" ];then
  506. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  507. fi
  508. if [ $test = "ltp" ];then
  509. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  510. fi
  511. if [ $test = "mksh" ];then
  512. DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
  513. fi
  514. if [ $test = "libc" ];then
  515. case $lib in
  516. uclibc-ng)
  517. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  518. ;;
  519. glibc)
  520. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  521. ;;
  522. musl)
  523. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  524. ;;
  525. esac
  526. fi
  527. if [ $test = "native" ];then
  528. case $lib in
  529. uclibc-ng)
  530. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  531. ;;
  532. musl)
  533. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  534. ;;
  535. glibc)
  536. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  537. ;;
  538. esac
  539. fi
  540. case $arch in
  541. aarch64)
  542. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  543. compile "$DEFAULT"
  544. ;;
  545. arcv1)
  546. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  547. compile "$DEFAULT"
  548. ;;
  549. arcv2)
  550. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  551. compile "$DEFAULT"
  552. ;;
  553. arcv1-be)
  554. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  555. compile "$DEFAULT"
  556. ;;
  557. arcv2-be)
  558. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  559. compile "$DEFAULT"
  560. ;;
  561. armv5)
  562. if [ "$lib" = "newlib" ]; then
  563. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=arm ADK_TARGET_ENDIAN=little ADK_TARGET_SYSTEM=toolchain-arm"
  564. else
  565. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  566. fi
  567. compile "$DEFAULT"
  568. ;;
  569. armeb)
  570. if [ "$lib" = "newlib" ]; then
  571. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=arm ADK_TARGET_ENDIAN=big ADK_TARGET_SYSTEM=toolchain-arm"
  572. else
  573. 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"
  574. fi
  575. compile "$DEFAULT"
  576. ;;
  577. armv7)
  578. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  579. compile "$DEFAULT"
  580. ;;
  581. avr32)
  582. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  583. compile "$DEFAULT"
  584. ;;
  585. bfin)
  586. if [ "$lib" = "newlib" ]; then
  587. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  588. else
  589. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  590. fi
  591. compile "$DEFAULT"
  592. ;;
  593. c6x)
  594. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  595. compile "$DEFAULT"
  596. ;;
  597. crisv10)
  598. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  599. compile "$DEFAULT"
  600. ;;
  601. crisv32)
  602. if [ "$lib" = "newlib" ]; then
  603. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_ENDIAN=little ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv32"
  604. else
  605. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  606. fi
  607. compile "$DEFAULT"
  608. ;;
  609. ia64)
  610. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=ia64 ADK_TARGET_SYSTEM=toolchain-ia64"
  611. compile "$DEFAULT"
  612. ;;
  613. h8300)
  614. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  615. compile "$DEFAULT"
  616. ;;
  617. lm32)
  618. if [ "$lib" = "newlib" ]; then
  619. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=toolchain-$arch"
  620. else
  621. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  622. fi
  623. compile "$DEFAULT"
  624. ;;
  625. m68k)
  626. if [ "$lib" = "newlib" ]; then
  627. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=toolchain-m68k"
  628. else
  629. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  630. fi
  631. compile "$DEFAULT"
  632. ;;
  633. m68k-nommu)
  634. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  635. compile "$DEFAULT"
  636. ;;
  637. metag)
  638. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-metag"
  639. compile "$DEFAULT"
  640. ;;
  641. microblazebe)
  642. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  643. compile "$DEFAULT"
  644. ;;
  645. microblazeel)
  646. if [ "$lib" = "newlib" ]; then
  647. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=toolchain-microblaze ADK_TARGET_ENDIAN=little"
  648. else
  649. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  650. fi
  651. compile "$DEFAULT"
  652. ;;
  653. mips)
  654. if [ "$lib" = "newlib" ]; then
  655. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=toolchain-mips ADK_TARGET_ENDIAN=big"
  656. else
  657. 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"
  658. fi
  659. compile "$DEFAULT"
  660. ;;
  661. mipssf)
  662. 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"
  663. compile "$DEFAULT"
  664. ;;
  665. mipsel)
  666. if [ "$lib" = "newlib" ]; then
  667. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=toolchain-mips ADK_TARGET_ENDIAN=little"
  668. else
  669. 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"
  670. fi
  671. compile "$DEFAULT"
  672. ;;
  673. mipselsf)
  674. 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"
  675. compile "$DEFAULT"
  676. ;;
  677. mips64)
  678. 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"
  679. compile "$DEFAULT"
  680. ;;
  681. mips64n32)
  682. 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"
  683. compile "$DEFAULT"
  684. ;;
  685. mips64n64)
  686. 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"
  687. compile "$DEFAULT"
  688. ;;
  689. mips64el)
  690. 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"
  691. compile "$DEFAULT"
  692. ;;
  693. mips64eln32)
  694. 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"
  695. compile "$DEFAULT"
  696. ;;
  697. mips64eln64)
  698. 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"
  699. compile "$DEFAULT"
  700. ;;
  701. nios2)
  702. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  703. compile "$DEFAULT"
  704. ;;
  705. or1k)
  706. if [ "$lib" = "newlib" ]; then
  707. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=toolchain-$arch"
  708. else
  709. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  710. fi
  711. compile "$DEFAULT"
  712. ;;
  713. ppc)
  714. if [ "$lib" = "newlib" ]; then
  715. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=toolchain-ppc"
  716. else
  717. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  718. fi
  719. compile "$DEFAULT"
  720. ;;
  721. ppcsf)
  722. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  723. compile "$DEFAULT"
  724. ;;
  725. ppc64)
  726. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  727. compile "$DEFAULT"
  728. ;;
  729. s390)
  730. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=s390 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-s390"
  731. compile "$DEFAULT"
  732. ;;
  733. sh2)
  734. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=toolchain-sh ADK_TARGET_CPU=sh2"
  735. compile "$DEFAULT"
  736. ;;
  737. sh3)
  738. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=toolchain-sh ADK_TARGET_CPU=sh3"
  739. compile "$DEFAULT"
  740. ;;
  741. sh4)
  742. if [ "$lib" = "newlib" ]; then
  743. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=toolchain-sh ADK_TARGET_CPU=sh4"
  744. else
  745. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  746. fi
  747. compile "$DEFAULT"
  748. ;;
  749. sh4eb)
  750. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  751. compile "$DEFAULT"
  752. ;;
  753. sparc|sparc64)
  754. if [ "$lib" = "newlib" ]; then
  755. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=toolchain-$arch"
  756. else
  757. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  758. fi
  759. compile "$DEFAULT"
  760. ;;
  761. tile)
  762. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  763. compile "$DEFAULT"
  764. ;;
  765. x86|x86_64)
  766. if [ "$lib" = "newlib" ]; then
  767. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=toolchain-$arch"
  768. else
  769. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  770. fi
  771. compile "$DEFAULT"
  772. ;;
  773. *)
  774. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  775. compile "$DEFAULT"
  776. ;;
  777. esac
  778. if [ $? -ne 0 ];then
  779. echo "build failed"
  780. exit 1
  781. fi
  782. cd ..
  783. }
  784. for lib in ${libc}; do
  785. case $lib in
  786. uclibc-ng)
  787. archlist=$arch_list_uclibcng
  788. version=1.0.9
  789. libver=uClibc-ng-${version}
  790. libdir=uClibc-ng
  791. ;;
  792. glibc)
  793. archlist=$arch_list_glibc
  794. version=2.22
  795. libver=glibc-${version}
  796. libdir=glibc
  797. ;;
  798. musl)
  799. archlist=$arch_list_musl
  800. version=1.1.12
  801. libver=musl-${version}
  802. libdir=musl
  803. ;;
  804. newlib)
  805. archlist=$arch_list_newlib
  806. version=2.2.0
  807. libver=newlib-${version}
  808. libdir=newlib
  809. ;;
  810. *)
  811. echo "$lib not supported"
  812. exit 1
  813. ;;
  814. esac
  815. if [ ! -z $archs ]; then
  816. archlist="$archs"
  817. fi
  818. if [ ! -z $source ]; then
  819. if [ ! -d $source ]; then
  820. echo "Not a directory."
  821. exit 1
  822. fi
  823. usrc=$(mktemp -d /tmp/XXXX)
  824. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  825. cp -a $source $usrc/$libver
  826. mkdir -p $topdir/openadk/dl 2>/dev/null
  827. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  828. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  829. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  830. fi
  831. # start with a clean dir
  832. if [ $cleandir -eq 1 ]; then
  833. echo "completely cleaning openadk build directory"
  834. (cd openadk && make cleandir)
  835. fi
  836. if [ ! -z "$tests" ];then
  837. testinfo="$tests testing"
  838. else
  839. testinfo="toolchain testing"
  840. fi
  841. echo "Summary: testing $archlist with C library $lib and $testinfo"
  842. sleep 2
  843. for arch in ${archlist}; do
  844. if [ $cont -eq 1 ]; then
  845. if [ -f "REPORT.${arch}.${tests}.${libver}" -o -f "REPORT.${arch}.toolchain.${libver}" ]; then
  846. echo "Skipping already run test for $arch"
  847. continue
  848. fi
  849. fi
  850. if [ "$arch" = "$skiparchs" ];then
  851. echo "Skipping $skiparchs"
  852. continue
  853. fi
  854. if [ $clean -eq 1 ]; then
  855. echo "cleaning openadk build directory"
  856. (cd openadk && make cleansystem)
  857. fi
  858. echo "Compiling base system and toolchain for $lib and $arch"
  859. build $lib $arch notest
  860. echo "$arch with $lib successfully build" > REPORT.${arch}.toolchain.${libver}
  861. if [ ! -z "$tests" ];then
  862. for test in ${tests}; do
  863. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" -o $test = "mksh" ];then
  864. case $lib in
  865. uclibc-ng)
  866. case $arch in
  867. armeb|avr32|bfin|c6x|crisv10|h8300|ia64|lm32|metag|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sh2|sh3|sh4eb)
  868. echo "runtime tests disabled for $arch."
  869. ;;
  870. *)
  871. build $lib $arch $test
  872. runtest $lib $arch $test
  873. ;;
  874. esac
  875. ;;
  876. musl)
  877. case $arch in
  878. armeb|or1k|sh4eb)
  879. echo "runtime tests disabled for $arch."
  880. ;;
  881. *)
  882. build $lib $arch $test
  883. runtest $lib $arch $test
  884. ;;
  885. esac
  886. ;;
  887. glibc)
  888. case $arch in
  889. armeb|ia64|m68k|nios2|s390|sh4eb|tile)
  890. echo "runtime tests disabled for $arch."
  891. ;;
  892. *)
  893. build $lib $arch $test
  894. runtest $lib $arch $test
  895. ;;
  896. esac
  897. ;;
  898. newlib)
  899. echo "runtime tests disabled for newlib."
  900. ;;
  901. esac
  902. else
  903. echo "Test $test is not valid. Allowed tests: $valid_tests"
  904. exit 1
  905. fi
  906. done
  907. fi
  908. done
  909. done
  910. echo "All tests finished."
  911. exit 0