embedded-test.sh 27 KB

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