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. suffix=
  153. libdir=lib
  154. march=${arch}
  155. case ${arch} in
  156. aarch64)
  157. cpu_arch=aarch64
  158. qemu_machine=virt
  159. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  160. ;;
  161. armv5)
  162. cpu_arch=arm
  163. march=arm-versatilepb
  164. qemu=qemu-system-${cpu_arch}
  165. qemu_machine=versatilepb
  166. suffix=soft_eabi
  167. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  168. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  169. ;;
  170. armv7)
  171. cpu_arch=arm
  172. march=arm-vexpress-a9
  173. qemu=qemu-system-${cpu_arch}
  174. qemu_machine=vexpress-a9
  175. suffix=hard_eabihf
  176. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  177. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  178. ;;
  179. arcv1)
  180. emulator=nsim
  181. cpu_arch=arc
  182. piggyback=1
  183. ;;
  184. arcv2)
  185. emulator=nsim
  186. cpu_arch=arc
  187. piggyback=1
  188. ;;
  189. crisv32)
  190. cpu_arch=crisv32
  191. march=cris
  192. qemu=qemu-system-${march}
  193. qemu_machine=axis-dev88
  194. piggyback=1
  195. ;;
  196. microblazeel)
  197. cpu_arch=microblazeel
  198. march=microblaze-ml605
  199. qemu_machine=petalogix-s3adsp1800
  200. ;;
  201. microblazebe)
  202. cpu_arch=microblaze
  203. march=microblaze-ml605
  204. qemu=qemu-system-${cpu_arch}
  205. qemu_machine=petalogix-s3adsp1800
  206. ;;
  207. mips)
  208. cpu_arch=mips
  209. qemu=qemu-system-${cpu_arch}
  210. qemu_machine=malta
  211. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  212. suffix=hard
  213. ;;
  214. mipssf)
  215. cpu_arch=mips
  216. march=mips
  217. qemu=qemu-system-${cpu_arch}
  218. qemu_machine=malta
  219. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  220. suffix=soft
  221. ;;
  222. mipsel)
  223. cpu_arch=mipsel
  224. march=mips
  225. qemu=qemu-system-${cpu_arch}
  226. qemu_machine=malta
  227. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  228. suffix=hard
  229. ;;
  230. mipselsf)
  231. cpu_arch=mipsel
  232. march=mips
  233. qemu=qemu-system-${cpu_arch}
  234. qemu_machine=malta
  235. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  236. suffix=soft
  237. ;;
  238. mips64)
  239. cpu_arch=mips64
  240. qemu_machine=malta
  241. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  242. suffix=o32
  243. ;;
  244. mips64n32)
  245. cpu_arch=mips64
  246. march=mips64
  247. qemu=qemu-system-${cpu_arch}
  248. qemu_machine=malta
  249. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  250. suffix=n32
  251. ;;
  252. mips64n64)
  253. cpu_arch=mips64
  254. march=mips64
  255. qemu=qemu-system-${cpu_arch}
  256. qemu_machine=malta
  257. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  258. suffix=n64
  259. ;;
  260. mips64el)
  261. cpu_arch=mips64el
  262. march=mips64
  263. qemu_machine=malta
  264. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  265. suffix=o32
  266. ;;
  267. mips64eln32)
  268. cpu_arch=mips64el
  269. march=mips64
  270. qemu=qemu-system-${cpu_arch}
  271. qemu_machine=malta
  272. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  273. suffix=n32
  274. ;;
  275. mips64eln64)
  276. cpu_arch=mips64el
  277. march=mips64
  278. qemu=qemu-system-${cpu_arch}
  279. qemu_machine=malta
  280. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  281. suffix=n64
  282. ;;
  283. ppcsf)
  284. cpu_arch=ppc
  285. march=ppc-bamboo
  286. qemu=qemu-system-${cpu_arch}
  287. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  288. qemu_machine=bamboo
  289. suffix=soft
  290. ;;
  291. ppc)
  292. cpu_arch=ppc
  293. march=ppc-macppc
  294. qemu=qemu-system-${cpu_arch}
  295. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  296. qemu_machine=mac99
  297. suffix=hard
  298. noappend=1
  299. ;;
  300. powerpc64|ppc64)
  301. cpu_arch=ppc64
  302. qemu=qemu-system-${cpu_arch}
  303. qemu_machine=pseries
  304. ;;
  305. sh)
  306. cpu_arch=sh4
  307. qemu=qemu-system-${cpu_arch}
  308. qemu_machine=r2d
  309. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  310. ;;
  311. sheb)
  312. cpu_arch=sh4eb
  313. march=sh
  314. qemu=qemu-system-${cpu_arch}
  315. qemu_machine=r2d
  316. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  317. ;;
  318. sparc)
  319. cpu_arch=sparc
  320. qemu_machine=SS-5
  321. ;;
  322. sparc64)
  323. cpu_arch=sparc64
  324. qemu_machine=sun4u
  325. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  326. ;;
  327. x86)
  328. cpu_arch=i686
  329. qemu=qemu-system-i386
  330. qemu_machine=pc
  331. qemu_args="${qemu_args}"
  332. ;;
  333. x86_64)
  334. cpu_arch=x86_64
  335. qemu_machine=pc
  336. libdir=lib64
  337. ;;
  338. x86_64_x32)
  339. cpu_arch=x86_64
  340. qemu=qemu-system-${cpu_arch}
  341. qemu_machine=pc
  342. libdir=libx32
  343. ;;
  344. xtensa)
  345. cpu_arch=xtensa
  346. qemu=qemu-system-${cpu_arch}
  347. qemu_machine=lx60
  348. qemu_args="${qemu_args} -cpu dc233c"
  349. ;;
  350. *)
  351. echo "architecture ${arch} not supported"; exit 1;;
  352. esac
  353. case $emulator in
  354. qemu)
  355. echo "Using QEMU as emulator"
  356. if ! which $qemu >/dev/null; then
  357. echo "Checking if $qemu is installed... failed"
  358. exit 1
  359. fi
  360. qemuver=$(${qemu} -version|awk '{ print $4 }')
  361. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  362. echo "Your qemu version is too old. Please update to 2.1 or greater"
  363. exit 1
  364. fi
  365. ;;
  366. nsim)
  367. echo "Using Synopsys NSIM as simulator"
  368. if ! which nsimdrv >/dev/null; then
  369. echo "Checking if $emulator is installed... failed"
  370. exit 1
  371. fi
  372. ;;
  373. *)
  374. echo "emulator/simulator not supported"; exit 1;;
  375. esac
  376. echo "Starting test for $lib and $arch"
  377. # check if initramfs or piggyback is used
  378. if [ $piggyback -eq 1 ]; then
  379. echo "Using extra directory for test image creation"
  380. root=openadk/extra
  381. rm -rf openadk/extra 2>/dev/null
  382. mkdir openadk/extra 2>/dev/null
  383. if [ ! -z $suffix ]; then
  384. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  385. else
  386. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  387. fi
  388. else
  389. echo "Generating root filesystem for test run"
  390. root=$(mktemp -d /tmp/XXXX)
  391. if [ ! -z $suffix ]; then
  392. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  393. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  394. else
  395. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  396. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  397. fi
  398. if [ ! -f $archive ];then
  399. echo "No root filesystem available for architecture ${arch} tried $archive"
  400. exit 1
  401. fi
  402. tar -xf $archive -C $root
  403. fi
  404. # creating test script to be run on boot
  405. cat > ${root}/run.sh << EOF
  406. #!/bin/sh
  407. uname -a
  408. if [ \$ntpserver ]; then
  409. rdate \$ntpserver
  410. else
  411. rdate time.fu-berlin.de
  412. fi
  413. EOF
  414. if [ $test = "boot" ];then
  415. cat >> ${root}/run.sh << EOF
  416. file /bin/busybox
  417. size /bin/busybox
  418. for i in \$(ls /lib/*.so|grep -v libgcc);do
  419. size \$i
  420. done
  421. exit
  422. EOF
  423. fi
  424. if [ $test = "ltp" ];then
  425. cat >> ${root}/run.sh << EOF
  426. /opt/ltp/runltp
  427. exit
  428. EOF
  429. fi
  430. if [ $test = "libc" ];then
  431. case $lib in
  432. uclibc-ng)
  433. cat >> ${root}/run.sh << EOF
  434. cd /opt/uclibc-ng/test
  435. sh ./uclibcng-testrunner.sh
  436. exit
  437. EOF
  438. ;;
  439. musl|glibc)
  440. cat >> ${root}/run.sh << EOF
  441. cd /opt/libc-test
  442. CC=: make run
  443. exit
  444. EOF
  445. ;;
  446. esac
  447. fi
  448. chmod u+x ${root}/run.sh
  449. if [ $piggyback -eq 1 ]; then
  450. (cd openadk && make v)
  451. else
  452. echo "Creating initramfs filesystem"
  453. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  454. rm -rf $root
  455. qemu_args="$qemu_args -initrd initramfs.${arch}"
  456. fi
  457. # qemu-ppc overwrites existing commandline
  458. if [ $noappend -eq 0 ]; then
  459. qemu_args="$qemu_args ${qemu_append}"
  460. fi
  461. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  462. case $emulator in
  463. qemu)
  464. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic"
  465. ${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}
  466. ;;
  467. nsim)
  468. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  469. ./openadk/scripts/nsim.sh ${arch} ${kernel}
  470. ;;
  471. esac
  472. if [ $? -eq 0 ];then
  473. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${libver}"
  474. echo
  475. else
  476. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  477. echo
  478. fi
  479. }
  480. compile() {
  481. rm .config* .defconfig 2>/dev/null
  482. make $1 defconfig
  483. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  484. make $1 all
  485. }
  486. build() {
  487. lib=$1
  488. arch=$2
  489. test=$3
  490. cd openadk
  491. make prereq
  492. # always trigger regeneration of kernel config
  493. rm build_*_${lib}_${arch}*/linux/.config > /dev/null 2>&1
  494. # rebuild C library package
  495. rm -rf toolchain_build_*_${lib}_${arch}*/w-${libdir}/
  496. make package=$lib clean > /dev/null 2>&1
  497. DEFAULT="ADK_TARGET_LIBC=$lib"
  498. if [ $debug -eq 1 ];then
  499. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  500. fi
  501. if [ $git -eq 1 ];then
  502. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  503. fi
  504. if [ $test = "boot" ];then
  505. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  506. fi
  507. if [ $test = "ltp" ];then
  508. DEFAULT="$DEFAULT ADK_TEST_LTP=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. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  559. compile "$DEFAULT"
  560. ;;
  561. armeb)
  562. 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"
  563. compile "$DEFAULT"
  564. ;;
  565. armv7)
  566. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  567. compile "$DEFAULT"
  568. ;;
  569. avr32)
  570. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  571. compile "$DEFAULT"
  572. ;;
  573. bfin)
  574. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  575. compile "$DEFAULT"
  576. ;;
  577. c6x)
  578. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  579. compile "$DEFAULT"
  580. ;;
  581. crisv10)
  582. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  583. compile "$DEFAULT"
  584. ;;
  585. crisv32)
  586. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  587. compile "$DEFAULT"
  588. ;;
  589. m68k)
  590. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  591. compile "$DEFAULT"
  592. ;;
  593. m68k-nommu)
  594. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  595. compile "$DEFAULT"
  596. ;;
  597. metag)
  598. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-metag"
  599. compile "$DEFAULT"
  600. ;;
  601. microblazebe)
  602. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  603. compile "$DEFAULT"
  604. ;;
  605. microblazeel)
  606. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  607. compile "$DEFAULT"
  608. ;;
  609. mips)
  610. 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"
  611. compile "$DEFAULT"
  612. ;;
  613. mipssf)
  614. 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"
  615. compile "$DEFAULT"
  616. ;;
  617. mipsel)
  618. 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"
  619. compile "$DEFAULT"
  620. ;;
  621. mipselsf)
  622. 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"
  623. compile "$DEFAULT"
  624. ;;
  625. mips64)
  626. 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"
  627. compile "$DEFAULT"
  628. ;;
  629. mips64n32)
  630. 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"
  631. compile "$DEFAULT"
  632. ;;
  633. mips64n64)
  634. 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"
  635. compile "$DEFAULT"
  636. ;;
  637. mips64el)
  638. 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"
  639. compile "$DEFAULT"
  640. ;;
  641. mips64eln32)
  642. 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"
  643. compile "$DEFAULT"
  644. ;;
  645. mips64eln64)
  646. 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"
  647. compile "$DEFAULT"
  648. ;;
  649. nios2)
  650. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  651. compile "$DEFAULT"
  652. ;;
  653. or1k)
  654. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  655. compile "$DEFAULT"
  656. ;;
  657. ppc)
  658. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  659. compile "$DEFAULT"
  660. ;;
  661. ppcsf)
  662. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  663. compile "$DEFAULT"
  664. ;;
  665. ppc64)
  666. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  667. compile "$DEFAULT"
  668. ;;
  669. sh)
  670. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  671. compile "$DEFAULT"
  672. ;;
  673. sheb)
  674. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  675. compile "$DEFAULT"
  676. ;;
  677. tile)
  678. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  679. compile "$DEFAULT"
  680. ;;
  681. *)
  682. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  683. compile "$DEFAULT"
  684. ;;
  685. esac
  686. if [ $? -ne 0 ];then
  687. echo "build failed"
  688. exit 1
  689. fi
  690. cd ..
  691. }
  692. for lib in ${libc}; do
  693. case $lib in
  694. uclibc-ng)
  695. archlist=$arch_list_uclibcng
  696. version=1.0.8
  697. gitversion=git
  698. if [ $git -eq 1 ]; then
  699. libver=uClibc-ng-${gitversion}
  700. else
  701. libver=uClibc-ng-${version}
  702. fi
  703. libdir=uClibc-ng
  704. ;;
  705. glibc)
  706. archlist=$arch_list_glibc
  707. version=2.22
  708. gitversion=2.22.90
  709. if [ $git -eq 1 ]; then
  710. libver=glibc-${gitversion}
  711. else
  712. libver=glibc-${version}
  713. fi
  714. libdir=glibc
  715. ;;
  716. musl)
  717. archlist=$arch_list_musl
  718. version=1.1.11
  719. gitversion=git
  720. if [ $git -eq 1 ]; then
  721. libver=musl-${gitversion}
  722. else
  723. libver=musl-${version}
  724. fi
  725. libdir=musl
  726. ;;
  727. esac
  728. if [ ! -z $archtolist ]; then
  729. archlist="$archtolist"
  730. fi
  731. if [ ! -z $source ]; then
  732. if [ ! -d $source ]; then
  733. echo "Not a directory."
  734. exit 1
  735. fi
  736. if [ $fast -eq 0 ]; then
  737. usrc=$(mktemp -d /tmp/XXXX)
  738. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  739. cp -a $source $usrc/$libver
  740. mkdir -p $topdir/openadk/dl 2>/dev/null
  741. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  742. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  743. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  744. fi
  745. fi
  746. # start with a clean dir
  747. if [ $clean -eq 1 ]; then
  748. (cd openadk && make cleandir)
  749. fi
  750. echo "Architectures to test: $archlist"
  751. for arch in ${archlist}; do
  752. if [ $break -eq 1 -a -f "REPORT.${arch}.${lib}.${tests}.${version}" ]; then
  753. echo "Skipping this test after last build break"
  754. continue
  755. fi
  756. echo "Compiling base system and toolchain for $lib and $arch"
  757. build $lib $arch notest
  758. if [ ! -z "$tests" ];then
  759. for test in ${tests}; do
  760. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  761. case $lib in
  762. uclibc-ng)
  763. case $arch in
  764. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  765. echo "runtime tests disabled for $arch."
  766. ;;
  767. *)
  768. build $lib $arch $test
  769. runtest $lib $arch $test
  770. ;;
  771. esac
  772. ;;
  773. musl)
  774. case $arch in
  775. armeb|or1k|sheb)
  776. echo "runtime tests disabled for $arch."
  777. ;;
  778. *)
  779. build $lib $arch $test
  780. runtest $lib $arch $test
  781. ;;
  782. esac
  783. ;;
  784. glibc)
  785. case $arch in
  786. armeb|m68k|nios2|sheb|sparc64|tile)
  787. echo "runtime tests disabled for $arch."
  788. ;;
  789. *)
  790. build $lib $arch $test
  791. runtest $lib $arch $test
  792. ;;
  793. esac
  794. ;;
  795. esac
  796. else
  797. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  798. exit 1
  799. fi
  800. done
  801. fi
  802. done
  803. done
  804. echo "All tests finished."
  805. exit 0