embedded-test.sh 23 KB

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