embedded-test.sh 24 KB

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