embedded-test.sh 27 KB

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