embedded-test.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  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 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. qemu=qemu-system-${cpu_arch}
  286. qemu_machine=r2d
  287. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  288. ;;
  289. sh4eb)
  290. cpu_arch=sh4eb
  291. march=sh
  292. qemu=qemu-system-${cpu_arch}
  293. qemu_machine=r2d
  294. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  295. ;;
  296. sparc)
  297. cpu_arch=sparc
  298. qemu_machine=SS-5
  299. ;;
  300. sparc64)
  301. cpu_arch=sparc64
  302. qemu_machine=sun4u
  303. qemu_args="${qemu_args} -net nic,model=e1000 -net user"
  304. ;;
  305. x86)
  306. cpu_arch=i686
  307. qemu=qemu-system-i386
  308. qemu_machine=pc
  309. qemu_args="${qemu_args}"
  310. ;;
  311. x86_64)
  312. cpu_arch=x86_64
  313. qemu_machine=pc
  314. libdir=lib64
  315. ;;
  316. x86_64_x32)
  317. cpu_arch=x86_64
  318. qemu=qemu-system-${cpu_arch}
  319. qemu_machine=pc
  320. libdir=libx32
  321. ;;
  322. xtensa)
  323. cpu_arch=xtensa
  324. qemu=qemu-system-${cpu_arch}
  325. qemu_machine=lx60
  326. qemu_args="${qemu_args} -cpu dc233c"
  327. ;;
  328. *)
  329. echo "architecture ${arch} not supported"; exit 1;;
  330. esac
  331. case $emulator in
  332. qemu)
  333. echo "Using QEMU as emulator"
  334. if ! which $qemu >/dev/null; then
  335. echo "Checking if $qemu is installed... failed"
  336. exit 1
  337. fi
  338. qemuver=$(${qemu} -version|awk '{ print $4 }')
  339. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  340. echo "Your qemu version is too old. Please update to 2.1 or greater"
  341. exit 1
  342. fi
  343. ;;
  344. nsim)
  345. echo "Using Synopsys NSIM as simulator"
  346. if ! which nsimdrv >/dev/null; then
  347. echo "Checking if $emulator is installed... failed"
  348. exit 1
  349. fi
  350. ;;
  351. *)
  352. echo "emulator/simulator not supported"; exit 1;;
  353. esac
  354. echo "Starting test for $lib and $arch"
  355. # check if initramfs or piggyback is used
  356. if [ $piggyback -eq 1 ]; then
  357. echo "Using extra directory for test image creation"
  358. root=openadk/extra
  359. rm -rf openadk/extra 2>/dev/null
  360. mkdir openadk/extra 2>/dev/null
  361. if [ ! -z $suffix ]; then
  362. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  363. else
  364. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  365. fi
  366. else
  367. echo "Generating root filesystem for test run"
  368. root=$(mktemp -d /tmp/XXXX)
  369. if [ ! -z $suffix ]; then
  370. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  371. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  372. else
  373. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  374. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  375. fi
  376. if [ ! -f $archive ];then
  377. echo "No root filesystem available for architecture ${arch} tried $archive"
  378. exit 1
  379. fi
  380. tar -xf $archive -C $root
  381. fi
  382. # creating test script to be run on boot
  383. cat > ${root}/run.sh << EOF
  384. #!/bin/sh
  385. uname -a
  386. if [ \$ntpserver ]; then
  387. rdate \$ntpserver
  388. else
  389. rdate time.fu-berlin.de
  390. fi
  391. EOF
  392. if [ $test = "boot" ];then
  393. cat >> ${root}/run.sh << EOF
  394. file /bin/busybox
  395. size /bin/busybox
  396. for i in \$(ls /lib/*.so|grep -v libgcc);do
  397. size \$i
  398. done
  399. exit
  400. EOF
  401. fi
  402. if [ $test = "ltp" ];then
  403. cat >> ${root}/run.sh << EOF
  404. /opt/ltp/runltp
  405. exit
  406. EOF
  407. fi
  408. if [ $test = "mksh" ];then
  409. cat >> ${root}/run.sh << EOF
  410. mksh /opt/mksh/test.sh
  411. exit
  412. EOF
  413. fi
  414. if [ $test = "libc" ];then
  415. case $lib in
  416. uclibc-ng)
  417. cat >> ${root}/run.sh << EOF
  418. cd /opt/uclibc-ng/test
  419. sh ./uclibcng-testrunner.sh
  420. exit
  421. EOF
  422. ;;
  423. musl|glibc)
  424. cat >> ${root}/run.sh << EOF
  425. cd /opt/libc-test
  426. CC=: make run
  427. exit
  428. EOF
  429. ;;
  430. esac
  431. fi
  432. chmod u+x ${root}/run.sh
  433. if [ $piggyback -eq 1 ]; then
  434. (cd openadk && make v)
  435. else
  436. echo "Creating initramfs filesystem"
  437. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  438. rm -rf $root
  439. qemu_args="$qemu_args -initrd initramfs.${arch}"
  440. fi
  441. # qemu-ppc overwrites existing commandline
  442. if [ $noappend -eq 0 ]; then
  443. qemu_args="$qemu_args ${qemu_append}"
  444. fi
  445. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  446. case $emulator in
  447. qemu)
  448. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic"
  449. ${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}
  450. ;;
  451. nsim)
  452. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  453. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  454. ;;
  455. esac
  456. if [ $? -eq 0 ];then
  457. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  458. echo
  459. else
  460. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  461. echo
  462. fi
  463. }
  464. compile() {
  465. rm .config* .defconfig 2>/dev/null
  466. make $1 defconfig
  467. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  468. make $1 all
  469. }
  470. build() {
  471. lib=$1
  472. arch=$2
  473. test=$3
  474. cd openadk
  475. make prereq
  476. make package=$lib clean > /dev/null 2>&1
  477. DEFAULT="ADK_TARGET_LIBC=$lib"
  478. if [ $debug -eq 1 ];then
  479. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  480. fi
  481. if [ $test = "boot" ];then
  482. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  483. fi
  484. if [ $test = "ltp" ];then
  485. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  486. fi
  487. if [ $test = "mksh" ];then
  488. DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
  489. fi
  490. if [ $test = "libc" ];then
  491. case $lib in
  492. uclibc-ng)
  493. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  494. ;;
  495. glibc)
  496. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  497. ;;
  498. musl)
  499. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  500. ;;
  501. esac
  502. fi
  503. if [ $test = "native" ];then
  504. case $lib in
  505. uclibc-ng)
  506. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  507. ;;
  508. musl)
  509. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  510. ;;
  511. glibc)
  512. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  513. ;;
  514. esac
  515. fi
  516. case $arch in
  517. aarch64)
  518. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  519. compile "$DEFAULT"
  520. ;;
  521. arcv1)
  522. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  523. compile "$DEFAULT"
  524. ;;
  525. arcv2)
  526. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  527. compile "$DEFAULT"
  528. ;;
  529. arcv1-be)
  530. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  531. compile "$DEFAULT"
  532. ;;
  533. arcv2-be)
  534. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  535. compile "$DEFAULT"
  536. ;;
  537. armv5)
  538. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  539. compile "$DEFAULT"
  540. ;;
  541. armeb)
  542. 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"
  543. compile "$DEFAULT"
  544. ;;
  545. armv7)
  546. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  547. compile "$DEFAULT"
  548. ;;
  549. avr32)
  550. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  551. compile "$DEFAULT"
  552. ;;
  553. bfin)
  554. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  555. compile "$DEFAULT"
  556. ;;
  557. c6x)
  558. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  559. compile "$DEFAULT"
  560. ;;
  561. crisv10)
  562. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  563. compile "$DEFAULT"
  564. ;;
  565. crisv32)
  566. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  567. compile "$DEFAULT"
  568. ;;
  569. h8300)
  570. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  571. compile "$DEFAULT"
  572. ;;
  573. m68k)
  574. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  575. compile "$DEFAULT"
  576. ;;
  577. m68k-nommu)
  578. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  579. compile "$DEFAULT"
  580. ;;
  581. metag)
  582. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-metag"
  583. compile "$DEFAULT"
  584. ;;
  585. microblazebe)
  586. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  587. compile "$DEFAULT"
  588. ;;
  589. microblazeel)
  590. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  591. compile "$DEFAULT"
  592. ;;
  593. mips)
  594. 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"
  595. compile "$DEFAULT"
  596. ;;
  597. mipssf)
  598. 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"
  599. compile "$DEFAULT"
  600. ;;
  601. mipsel)
  602. 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"
  603. compile "$DEFAULT"
  604. ;;
  605. mipselsf)
  606. 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"
  607. compile "$DEFAULT"
  608. ;;
  609. mips64)
  610. 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"
  611. compile "$DEFAULT"
  612. ;;
  613. mips64n32)
  614. 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"
  615. compile "$DEFAULT"
  616. ;;
  617. mips64n64)
  618. 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"
  619. compile "$DEFAULT"
  620. ;;
  621. mips64el)
  622. 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"
  623. compile "$DEFAULT"
  624. ;;
  625. mips64eln32)
  626. 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"
  627. compile "$DEFAULT"
  628. ;;
  629. mips64eln64)
  630. 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"
  631. compile "$DEFAULT"
  632. ;;
  633. nios2)
  634. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  635. compile "$DEFAULT"
  636. ;;
  637. or1k)
  638. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  639. compile "$DEFAULT"
  640. ;;
  641. ppc)
  642. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  643. compile "$DEFAULT"
  644. ;;
  645. ppcsf)
  646. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  647. compile "$DEFAULT"
  648. ;;
  649. ppc64)
  650. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  651. compile "$DEFAULT"
  652. ;;
  653. sh4)
  654. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  655. compile "$DEFAULT"
  656. ;;
  657. sh4eb)
  658. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  659. compile "$DEFAULT"
  660. ;;
  661. tile)
  662. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  663. compile "$DEFAULT"
  664. ;;
  665. *)
  666. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  667. compile "$DEFAULT"
  668. ;;
  669. esac
  670. if [ $? -ne 0 ];then
  671. echo "build failed"
  672. exit 1
  673. fi
  674. cd ..
  675. }
  676. for lib in ${libc}; do
  677. case $lib in
  678. uclibc-ng)
  679. archlist=$arch_list_uclibcng
  680. version=1.0.9
  681. libver=uClibc-ng-${version}
  682. libdir=uClibc-ng
  683. ;;
  684. glibc)
  685. archlist=$arch_list_glibc
  686. version=2.22
  687. libver=glibc-${version}
  688. libdir=glibc
  689. ;;
  690. musl)
  691. archlist=$arch_list_musl
  692. version=1.1.11
  693. libver=musl-${version}
  694. libdir=musl
  695. ;;
  696. *)
  697. echo "$lib not supported"
  698. exit 1
  699. ;;
  700. esac
  701. if [ ! -z $archs ]; then
  702. archlist="$archs"
  703. fi
  704. if [ ! -z $source ]; then
  705. if [ ! -d $source ]; then
  706. echo "Not a directory."
  707. exit 1
  708. fi
  709. usrc=$(mktemp -d /tmp/XXXX)
  710. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  711. cp -a $source $usrc/$libver
  712. mkdir -p $topdir/openadk/dl 2>/dev/null
  713. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  714. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  715. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  716. fi
  717. # start with a clean dir
  718. if [ $clean -eq 1 ]; then
  719. echo "cleaning openadk build directory"
  720. (cd openadk && make cleandir)
  721. fi
  722. if [ ! -z "$tests" ];then
  723. testinfo="$tests testing"
  724. else
  725. testinfo="toolchain testing"
  726. fi
  727. echo "Summary: testing $archlist with C library $lib and $testinfo"
  728. sleep 2
  729. for arch in ${archlist}; do
  730. if [ $continue -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" -o -f "REPORT.${arch}.toolchain.${libver}" ]; then
  731. echo "Skipping already run test for $arch"
  732. continue
  733. fi
  734. if [ "$arch" = "$skiparchs" ];then
  735. echo "Skipping $skiparchs"
  736. continue
  737. fi
  738. echo "Compiling base system and toolchain for $lib and $arch"
  739. build $lib $arch notest
  740. echo "$arch with $lib successfully build" > REPORT.${arch}.toolchain.${libver}
  741. if [ ! -z "$tests" ];then
  742. for test in ${tests}; do
  743. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" -o $test = "mksh" ];then
  744. case $lib in
  745. uclibc-ng)
  746. case $arch in
  747. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sh4eb)
  748. echo "runtime tests disabled for $arch."
  749. ;;
  750. *)
  751. build $lib $arch $test
  752. runtest $lib $arch $test
  753. ;;
  754. esac
  755. ;;
  756. musl)
  757. case $arch in
  758. armeb|or1k|sh4eb)
  759. echo "runtime tests disabled for $arch."
  760. ;;
  761. *)
  762. build $lib $arch $test
  763. runtest $lib $arch $test
  764. ;;
  765. esac
  766. ;;
  767. glibc)
  768. case $arch in
  769. armeb|m68k|nios2|sh4eb|tile)
  770. echo "runtime tests disabled for $arch."
  771. ;;
  772. *)
  773. build $lib $arch $test
  774. runtest $lib $arch $test
  775. ;;
  776. esac
  777. ;;
  778. esac
  779. else
  780. echo "Test $test is not valid. Allowed tests: $valid_tests"
  781. exit 1
  782. fi
  783. done
  784. fi
  785. done
  786. done
  787. echo "All tests finished."
  788. exit 0