embedded-test.sh 24 KB

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