embedded-test.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. #!/bin/sh
  2. # Copyright © 2014-2015
  3. # Waldemar Brodkorb <wbx@openadk.org>
  4. #
  5. # Provided that these terms and disclaimer and all copyright notices
  6. # are retained or reproduced in an accompanying document, permission
  7. # is granted to deal in this work without restriction, including un‐
  8. # limited rights to use, publicly perform, distribute, sell, modify,
  9. # merge, give away, or sublicence.
  10. #
  11. # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
  12. # the utmost extent permitted by applicable law, neither express nor
  13. # implied; without malicious intent or gross negligence. In no event
  14. # may a licensor, author or contributor be held liable for indirect,
  15. # direct, other damage, loss, or other issues arising in any way out
  16. # of dealing in the work, even if advised of the possibility of such
  17. # damage or existence of a defect, except proven that it results out
  18. # of said person’s immediate fault when using the work as intended.
  19. #
  20. # Alternatively, this work may be distributed under the Terms of the
  21. # General Public License, any version as published by the Free Soft‐
  22. # ware Foundation.
  23. # architecture specific notes:
  24. # sheb network card get no ip
  25. # sparc64 network card does not work right
  26. # m68k glibc toolchain building is broken at the moment
  27. # uClibc-ng
  28. arch_list_uclibcng="armv5 armv7 armeb arcv1 arcv2 arcv1-be arcv2-be avr32 bfin c6x crisv10 crisv32 h8300 m68k m68k-nommu microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 or1k ppc ppcsf sh sheb sparc x86 x86_64 xtensa"
  29. # musl
  30. arch_list_musl="aarch64 armv5 armv7 armeb microblazeel microblazebe mips mipssf mipsel mipselsf or1k ppc sh sheb x86 x86_64"
  31. # glibc
  32. arch_list_glibc="aarch64 armv5 armv7 armeb microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 nios2 ppc ppcsf ppc64 sh sheb sparc sparc64 tile x86 x86_64"
  33. topdir=$(pwd)
  34. openadk_git=http://git.openadk.org/openadk.git
  35. tools='make git wget xz cpio tar awk sed'
  36. f=0
  37. for tool in $tools; do
  38. if ! which $tool >/dev/null; then
  39. echo "Checking if $tool is installed... failed"
  40. f=1
  41. fi
  42. done
  43. if [ $f -eq 1 ];then exit 1; fi
  44. help() {
  45. cat >&2 <<EOF
  46. Syntax: $0 [ -l <libc> -a <arch> -t <tests> ]
  47. Explanation:
  48. -l: c library to use (uclibc-ng|musl|glibc)
  49. -g: use latest git version of C library
  50. -a: architecture to check (otherwise all supported)
  51. -u: update openadk source via git pull, before building
  52. -s: use directory with source for C library
  53. -f: enable fast compile, after a failure no rebuild
  54. -d: enable debug output from OpenADK
  55. -c: clean OpenADK build directory before build
  56. -m: start a shell in Qemu system for manual testing
  57. -n: set NTP server for test run
  58. -p: add extra packages to build
  59. -t: run tests (boot|libc|ltp|native)
  60. -h: help text
  61. EOF
  62. }
  63. break=0
  64. clean=0
  65. shell=0
  66. update=0
  67. debug=0
  68. git=0
  69. fast=0
  70. piggyback=0
  71. ntp=
  72. while getopts "bhfgumdqcn:a:s:l:t:p:" ch; do
  73. case $ch in
  74. m)
  75. shell=1
  76. ;;
  77. g)
  78. git=1
  79. ;;
  80. b)
  81. break=1
  82. ;;
  83. c)
  84. clean=1
  85. ;;
  86. d)
  87. debug=1
  88. ;;
  89. f)
  90. fast=1
  91. ;;
  92. u)
  93. update=1
  94. ;;
  95. s)
  96. source=$OPTARG
  97. ;;
  98. l)
  99. libc=$OPTARG
  100. ;;
  101. n)
  102. ntp=$OPTARG
  103. ;;
  104. a)
  105. archtolist=$OPTARG
  106. ;;
  107. p)
  108. pkgs=$OPTARG
  109. ;;
  110. t)
  111. tests=$OPTARG
  112. ;;
  113. h)
  114. help
  115. exit 1
  116. ;;
  117. esac
  118. done
  119. shift $((OPTIND - 1))
  120. if [ -z "$libc" ];then
  121. libc="uclibc-ng musl glibc"
  122. fi
  123. if [ ! -d openadk ];then
  124. git clone $openadk_git
  125. if [ $? -ne 0 ];then
  126. echo "Cloning from $openadk_git failed."
  127. exit 1
  128. fi
  129. else
  130. if [ $update -eq 1 ];then
  131. (cd openadk && git pull)
  132. if [ $? -ne 0 ];then
  133. echo "Updating from $openadk_git failed."
  134. exit 1
  135. fi
  136. fi
  137. fi
  138. runtest() {
  139. lib=$1
  140. arch=$2
  141. test=$3
  142. emulator=qemu
  143. qemu=qemu-system-${arch}
  144. qemu_args=
  145. if [ $ntp ]; then
  146. qemu_append="-append ntpserver=$ntp"
  147. fi
  148. if [ $shell -eq 1 ]; then
  149. qemu_append="-append shell"
  150. fi
  151. noappend=0
  152. piggyback=0
  153. suffix=
  154. libdir=lib
  155. march=${arch}
  156. case ${arch} in
  157. aarch64)
  158. cpu_arch=aarch64
  159. qemu_machine=virt
  160. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  161. ;;
  162. armv5)
  163. cpu_arch=arm
  164. march=arm-versatilepb
  165. qemu=qemu-system-${cpu_arch}
  166. qemu_machine=versatilepb
  167. suffix=soft_eabi
  168. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  169. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  170. ;;
  171. armv7)
  172. cpu_arch=arm
  173. march=arm-vexpress-a9
  174. qemu=qemu-system-${cpu_arch}
  175. qemu_machine=vexpress-a9
  176. suffix=hard_eabihf
  177. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  178. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  179. ;;
  180. arcv1)
  181. emulator=nsim
  182. cpu_arch=arc
  183. piggyback=1
  184. ;;
  185. arcv2)
  186. emulator=nsim
  187. cpu_arch=arc
  188. piggyback=1
  189. ;;
  190. crisv32)
  191. cpu_arch=crisv32
  192. march=cris
  193. qemu=qemu-system-${march}
  194. qemu_machine=axis-dev88
  195. piggyback=1
  196. ;;
  197. microblazeel)
  198. cpu_arch=microblazeel
  199. march=microblaze-ml605
  200. qemu_machine=petalogix-s3adsp1800
  201. ;;
  202. microblazebe)
  203. cpu_arch=microblaze
  204. march=microblaze-ml605
  205. qemu=qemu-system-${cpu_arch}
  206. qemu_machine=petalogix-s3adsp1800
  207. ;;
  208. mips)
  209. cpu_arch=mips
  210. qemu=qemu-system-${cpu_arch}
  211. qemu_machine=malta
  212. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  213. suffix=hard
  214. ;;
  215. mipssf)
  216. cpu_arch=mips
  217. march=mips
  218. qemu=qemu-system-${cpu_arch}
  219. qemu_machine=malta
  220. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  221. suffix=soft
  222. ;;
  223. mipsel)
  224. cpu_arch=mipsel
  225. march=mips
  226. qemu=qemu-system-${cpu_arch}
  227. qemu_machine=malta
  228. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  229. suffix=hard
  230. ;;
  231. mipselsf)
  232. cpu_arch=mipsel
  233. march=mips
  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=soft
  238. ;;
  239. mips64)
  240. cpu_arch=mips64
  241. qemu_machine=malta
  242. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  243. suffix=o32
  244. ;;
  245. mips64n32)
  246. cpu_arch=mips64
  247. march=mips64
  248. qemu=qemu-system-${cpu_arch}
  249. qemu_machine=malta
  250. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  251. suffix=n32
  252. ;;
  253. mips64n64)
  254. cpu_arch=mips64
  255. march=mips64
  256. qemu=qemu-system-${cpu_arch}
  257. qemu_machine=malta
  258. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  259. suffix=n64
  260. ;;
  261. mips64el)
  262. cpu_arch=mips64el
  263. march=mips64
  264. qemu_machine=malta
  265. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  266. suffix=o32
  267. ;;
  268. mips64eln32)
  269. cpu_arch=mips64el
  270. march=mips64
  271. qemu=qemu-system-${cpu_arch}
  272. qemu_machine=malta
  273. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  274. suffix=n32
  275. ;;
  276. mips64eln64)
  277. cpu_arch=mips64el
  278. march=mips64
  279. qemu=qemu-system-${cpu_arch}
  280. qemu_machine=malta
  281. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  282. suffix=n64
  283. ;;
  284. ppcsf)
  285. cpu_arch=ppc
  286. march=ppc-bamboo
  287. qemu=qemu-system-${cpu_arch}
  288. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  289. qemu_machine=bamboo
  290. suffix=soft
  291. ;;
  292. ppc)
  293. cpu_arch=ppc
  294. march=ppc-macppc
  295. qemu=qemu-system-${cpu_arch}
  296. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  297. qemu_machine=mac99
  298. suffix=hard
  299. noappend=1
  300. ;;
  301. powerpc64|ppc64)
  302. cpu_arch=ppc64
  303. qemu=qemu-system-${cpu_arch}
  304. qemu_machine=pseries
  305. ;;
  306. sh)
  307. cpu_arch=sh4
  308. qemu=qemu-system-${cpu_arch}
  309. qemu_machine=r2d
  310. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  311. ;;
  312. sheb)
  313. cpu_arch=sh4eb
  314. march=sh
  315. qemu=qemu-system-${cpu_arch}
  316. qemu_machine=r2d
  317. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  318. ;;
  319. sparc)
  320. cpu_arch=sparc
  321. qemu_machine=SS-5
  322. ;;
  323. sparc64)
  324. cpu_arch=sparc64
  325. qemu_machine=sun4u
  326. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  327. ;;
  328. x86)
  329. cpu_arch=i686
  330. qemu=qemu-system-i386
  331. qemu_machine=pc
  332. qemu_args="${qemu_args}"
  333. ;;
  334. x86_64)
  335. cpu_arch=x86_64
  336. qemu_machine=pc
  337. libdir=lib64
  338. ;;
  339. x86_64_x32)
  340. cpu_arch=x86_64
  341. qemu=qemu-system-${cpu_arch}
  342. qemu_machine=pc
  343. libdir=libx32
  344. ;;
  345. xtensa)
  346. cpu_arch=xtensa
  347. qemu=qemu-system-${cpu_arch}
  348. qemu_machine=lx60
  349. qemu_args="${qemu_args} -cpu dc233c"
  350. ;;
  351. *)
  352. echo "architecture ${arch} not supported"; exit 1;;
  353. esac
  354. case $emulator in
  355. qemu)
  356. echo "Using QEMU as emulator"
  357. if ! which $qemu >/dev/null; then
  358. echo "Checking if $qemu is installed... failed"
  359. exit 1
  360. fi
  361. qemuver=$(${qemu} -version|awk '{ print $4 }')
  362. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  363. echo "Your qemu version is too old. Please update to 2.1 or greater"
  364. exit 1
  365. fi
  366. ;;
  367. nsim)
  368. echo "Using Synopsys NSIM as simulator"
  369. if ! which nsimdrv >/dev/null; then
  370. echo "Checking if $emulator is installed... failed"
  371. exit 1
  372. fi
  373. ;;
  374. *)
  375. echo "emulator/simulator not supported"; exit 1;;
  376. esac
  377. echo "Starting test for $lib and $arch"
  378. # check if initramfs or piggyback is used
  379. if [ $piggyback -eq 1 ]; then
  380. echo "Using extra directory for test image creation"
  381. root=openadk/extra
  382. rm -rf openadk/extra 2>/dev/null
  383. mkdir openadk/extra 2>/dev/null
  384. if [ ! -z $suffix ]; then
  385. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  386. else
  387. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  388. fi
  389. else
  390. echo "Generating root filesystem for test run"
  391. root=$(mktemp -d /tmp/XXXX)
  392. if [ ! -z $suffix ]; then
  393. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  394. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  395. else
  396. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  397. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  398. fi
  399. if [ ! -f $archive ];then
  400. echo "No root filesystem available for architecture ${arch} tried $archive"
  401. exit 1
  402. fi
  403. tar -xf $archive -C $root
  404. fi
  405. # creating test script to be run on boot
  406. cat > ${root}/run.sh << EOF
  407. #!/bin/sh
  408. uname -a
  409. if [ \$ntpserver ]; then
  410. rdate \$ntpserver
  411. else
  412. rdate time.fu-berlin.de
  413. fi
  414. EOF
  415. if [ $test = "boot" ];then
  416. cat >> ${root}/run.sh << EOF
  417. file /bin/busybox
  418. size /bin/busybox
  419. for i in \$(ls /lib/*.so|grep -v libgcc);do
  420. size \$i
  421. done
  422. exit
  423. EOF
  424. fi
  425. if [ $test = "ltp" ];then
  426. cat >> ${root}/run.sh << EOF
  427. /opt/ltp/runltp
  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 -nographic"
  466. ${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}
  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. make $1 all
  486. }
  487. build() {
  488. lib=$1
  489. arch=$2
  490. test=$3
  491. cd openadk
  492. make prereq
  493. make package=$lib clean > /dev/null 2>&1
  494. DEFAULT="ADK_TARGET_LIBC=$lib"
  495. if [ $debug -eq 1 ];then
  496. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  497. fi
  498. if [ $git -eq 1 ];then
  499. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  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 = "libc" ];then
  508. case $lib in
  509. uclibc-ng)
  510. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  511. ;;
  512. glibc)
  513. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  514. ;;
  515. musl)
  516. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  517. ;;
  518. esac
  519. fi
  520. if [ $test = "native" ];then
  521. case $lib in
  522. uclibc-ng)
  523. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  524. ;;
  525. musl)
  526. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  527. ;;
  528. glibc)
  529. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  530. ;;
  531. esac
  532. fi
  533. case $arch in
  534. aarch64)
  535. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  536. compile "$DEFAULT"
  537. ;;
  538. arcv1)
  539. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  540. compile "$DEFAULT"
  541. ;;
  542. arcv2)
  543. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  544. compile "$DEFAULT"
  545. ;;
  546. arcv1-be)
  547. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  548. compile "$DEFAULT"
  549. ;;
  550. arcv2-be)
  551. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  552. compile "$DEFAULT"
  553. ;;
  554. armv5)
  555. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  556. compile "$DEFAULT"
  557. ;;
  558. armeb)
  559. 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"
  560. compile "$DEFAULT"
  561. ;;
  562. armv7)
  563. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  564. compile "$DEFAULT"
  565. ;;
  566. avr32)
  567. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  568. compile "$DEFAULT"
  569. ;;
  570. bfin)
  571. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  572. compile "$DEFAULT"
  573. ;;
  574. c6x)
  575. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  576. compile "$DEFAULT"
  577. ;;
  578. crisv10)
  579. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  580. compile "$DEFAULT"
  581. ;;
  582. crisv32)
  583. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  584. compile "$DEFAULT"
  585. ;;
  586. h8300)
  587. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  588. compile "$DEFAULT"
  589. ;;
  590. m68k)
  591. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  592. compile "$DEFAULT"
  593. ;;
  594. m68k-nommu)
  595. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  596. compile "$DEFAULT"
  597. ;;
  598. metag)
  599. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-metag"
  600. compile "$DEFAULT"
  601. ;;
  602. microblazebe)
  603. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  604. compile "$DEFAULT"
  605. ;;
  606. microblazeel)
  607. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  608. compile "$DEFAULT"
  609. ;;
  610. mips)
  611. 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"
  612. compile "$DEFAULT"
  613. ;;
  614. mipssf)
  615. 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"
  616. compile "$DEFAULT"
  617. ;;
  618. mipsel)
  619. 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"
  620. compile "$DEFAULT"
  621. ;;
  622. mipselsf)
  623. 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"
  624. compile "$DEFAULT"
  625. ;;
  626. mips64)
  627. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  628. compile "$DEFAULT"
  629. ;;
  630. mips64n32)
  631. 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"
  632. compile "$DEFAULT"
  633. ;;
  634. mips64n64)
  635. 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"
  636. compile "$DEFAULT"
  637. ;;
  638. mips64el)
  639. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  640. compile "$DEFAULT"
  641. ;;
  642. mips64eln32)
  643. 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"
  644. compile "$DEFAULT"
  645. ;;
  646. mips64eln64)
  647. 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"
  648. compile "$DEFAULT"
  649. ;;
  650. nios2)
  651. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  652. compile "$DEFAULT"
  653. ;;
  654. or1k)
  655. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  656. compile "$DEFAULT"
  657. ;;
  658. ppc)
  659. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  660. compile "$DEFAULT"
  661. ;;
  662. ppcsf)
  663. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  664. compile "$DEFAULT"
  665. ;;
  666. ppc64)
  667. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  668. compile "$DEFAULT"
  669. ;;
  670. sh)
  671. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  672. compile "$DEFAULT"
  673. ;;
  674. sheb)
  675. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  676. compile "$DEFAULT"
  677. ;;
  678. tile)
  679. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  680. compile "$DEFAULT"
  681. ;;
  682. *)
  683. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  684. compile "$DEFAULT"
  685. ;;
  686. esac
  687. if [ $? -ne 0 ];then
  688. echo "build failed"
  689. exit 1
  690. fi
  691. cd ..
  692. }
  693. for lib in ${libc}; do
  694. case $lib in
  695. uclibc-ng)
  696. archlist=$arch_list_uclibcng
  697. version=1.0.8
  698. gitversion=git
  699. if [ $git -eq 1 ]; then
  700. libver=uClibc-ng-${gitversion}
  701. else
  702. libver=uClibc-ng-${version}
  703. fi
  704. libdir=uClibc-ng
  705. ;;
  706. glibc)
  707. archlist=$arch_list_glibc
  708. version=2.22
  709. gitversion=2.22.90
  710. if [ $git -eq 1 ]; then
  711. libver=glibc-${gitversion}
  712. else
  713. libver=glibc-${version}
  714. fi
  715. libdir=glibc
  716. ;;
  717. musl)
  718. archlist=$arch_list_musl
  719. version=1.1.11
  720. gitversion=git
  721. if [ $git -eq 1 ]; then
  722. libver=musl-${gitversion}
  723. else
  724. libver=musl-${version}
  725. fi
  726. libdir=musl
  727. ;;
  728. esac
  729. if [ ! -z $archtolist ]; then
  730. archlist="$archtolist"
  731. fi
  732. if [ ! -z $source ]; then
  733. if [ ! -d $source ]; then
  734. echo "Not a directory."
  735. exit 1
  736. fi
  737. if [ $fast -eq 0 ]; then
  738. usrc=$(mktemp -d /tmp/XXXX)
  739. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  740. cp -a $source $usrc/$libver
  741. mkdir -p $topdir/openadk/dl 2>/dev/null
  742. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  743. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  744. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  745. fi
  746. fi
  747. # start with a clean dir
  748. if [ $clean -eq 1 ]; then
  749. (cd openadk && make cleandir)
  750. fi
  751. echo "Architectures to test: $archlist"
  752. for arch in ${archlist}; do
  753. if [ $break -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" ]; then
  754. echo "Skipping this test after last build break"
  755. continue
  756. fi
  757. echo "Compiling base system and toolchain for $lib and $arch"
  758. build $lib $arch notest
  759. if [ ! -z "$tests" ];then
  760. for test in ${tests}; do
  761. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  762. case $lib in
  763. uclibc-ng)
  764. case $arch in
  765. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  766. echo "runtime tests disabled for $arch."
  767. ;;
  768. *)
  769. build $lib $arch $test
  770. runtest $lib $arch $test
  771. ;;
  772. esac
  773. ;;
  774. musl)
  775. case $arch in
  776. armeb|or1k|sheb)
  777. echo "runtime tests disabled for $arch."
  778. ;;
  779. *)
  780. build $lib $arch $test
  781. runtest $lib $arch $test
  782. ;;
  783. esac
  784. ;;
  785. glibc)
  786. case $arch in
  787. armeb|m68k|nios2|sheb|sparc64|tile)
  788. echo "runtime tests disabled for $arch."
  789. ;;
  790. *)
  791. build $lib $arch $test
  792. runtest $lib $arch $test
  793. ;;
  794. esac
  795. ;;
  796. esac
  797. else
  798. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  799. exit 1
  800. fi
  801. done
  802. fi
  803. done
  804. done
  805. echo "All tests finished."
  806. exit 0