embedded-test.sh 24 KB

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