embedded-test.sh 24 KB

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