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