embedded-test.sh 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  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 = "mksh" ];then
  432. cat >> ${root}/run.sh << EOF
  433. mksh /opt/mksh/test.sh
  434. exit
  435. EOF
  436. fi
  437. if [ $test = "libc" ];then
  438. case $lib in
  439. uclibc-ng)
  440. cat >> ${root}/run.sh << EOF
  441. cd /opt/uclibc-ng/test
  442. sh ./uclibcng-testrunner.sh
  443. exit
  444. EOF
  445. ;;
  446. musl|glibc)
  447. cat >> ${root}/run.sh << EOF
  448. cd /opt/libc-test
  449. CC=: make run
  450. exit
  451. EOF
  452. ;;
  453. esac
  454. fi
  455. chmod u+x ${root}/run.sh
  456. if [ $piggyback -eq 1 ]; then
  457. (cd openadk && make v)
  458. else
  459. echo "Creating initramfs filesystem"
  460. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  461. rm -rf $root
  462. qemu_args="$qemu_args -initrd initramfs.${arch}"
  463. fi
  464. # qemu-ppc overwrites existing commandline
  465. if [ $noappend -eq 0 ]; then
  466. qemu_args="$qemu_args ${qemu_append}"
  467. fi
  468. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  469. case $emulator in
  470. qemu)
  471. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic"
  472. ${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}
  473. ;;
  474. nsim)
  475. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  476. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  477. ;;
  478. esac
  479. if [ $? -eq 0 ];then
  480. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  481. echo
  482. else
  483. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  484. echo
  485. fi
  486. }
  487. compile() {
  488. rm .config* .defconfig 2>/dev/null
  489. make $1 defconfig
  490. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  491. make $1 all
  492. }
  493. build() {
  494. lib=$1
  495. arch=$2
  496. test=$3
  497. cd openadk
  498. make prereq
  499. make package=$lib clean > /dev/null 2>&1
  500. DEFAULT="ADK_TARGET_LIBC=$lib"
  501. if [ $debug -eq 1 ];then
  502. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  503. fi
  504. if [ $git -eq 1 ];then
  505. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  506. fi
  507. if [ $test = "boot" ];then
  508. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  509. fi
  510. if [ $test = "ltp" ];then
  511. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  512. fi
  513. if [ $test = "mksh" ];then
  514. DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
  515. fi
  516. if [ $test = "libc" ];then
  517. case $lib in
  518. uclibc-ng)
  519. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  520. ;;
  521. glibc)
  522. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  523. ;;
  524. musl)
  525. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  526. ;;
  527. esac
  528. fi
  529. if [ $test = "native" ];then
  530. case $lib in
  531. uclibc-ng)
  532. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  533. ;;
  534. musl)
  535. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  536. ;;
  537. glibc)
  538. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  539. ;;
  540. esac
  541. fi
  542. case $arch in
  543. aarch64)
  544. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  545. compile "$DEFAULT"
  546. ;;
  547. arcv1)
  548. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  549. compile "$DEFAULT"
  550. ;;
  551. arcv2)
  552. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  553. compile "$DEFAULT"
  554. ;;
  555. arcv1-be)
  556. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  557. compile "$DEFAULT"
  558. ;;
  559. arcv2-be)
  560. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  561. compile "$DEFAULT"
  562. ;;
  563. armv5)
  564. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  565. compile "$DEFAULT"
  566. ;;
  567. armeb)
  568. 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"
  569. compile "$DEFAULT"
  570. ;;
  571. armv7)
  572. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  573. compile "$DEFAULT"
  574. ;;
  575. avr32)
  576. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  577. compile "$DEFAULT"
  578. ;;
  579. bfin)
  580. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  581. compile "$DEFAULT"
  582. ;;
  583. c6x)
  584. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  585. compile "$DEFAULT"
  586. ;;
  587. crisv10)
  588. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  589. compile "$DEFAULT"
  590. ;;
  591. crisv32)
  592. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  593. compile "$DEFAULT"
  594. ;;
  595. h8300)
  596. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  597. compile "$DEFAULT"
  598. ;;
  599. m68k)
  600. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  601. compile "$DEFAULT"
  602. ;;
  603. m68k-nommu)
  604. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  605. compile "$DEFAULT"
  606. ;;
  607. metag)
  608. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-metag"
  609. compile "$DEFAULT"
  610. ;;
  611. microblazebe)
  612. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  613. compile "$DEFAULT"
  614. ;;
  615. microblazeel)
  616. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  617. compile "$DEFAULT"
  618. ;;
  619. mips)
  620. 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"
  621. compile "$DEFAULT"
  622. ;;
  623. mipssf)
  624. 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"
  625. compile "$DEFAULT"
  626. ;;
  627. mipsel)
  628. 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"
  629. compile "$DEFAULT"
  630. ;;
  631. mipselsf)
  632. 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"
  633. compile "$DEFAULT"
  634. ;;
  635. mips64)
  636. 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"
  637. compile "$DEFAULT"
  638. ;;
  639. mips64n32)
  640. 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"
  641. compile "$DEFAULT"
  642. ;;
  643. mips64n64)
  644. 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"
  645. compile "$DEFAULT"
  646. ;;
  647. mips64el)
  648. 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"
  649. compile "$DEFAULT"
  650. ;;
  651. mips64eln32)
  652. 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"
  653. compile "$DEFAULT"
  654. ;;
  655. mips64eln64)
  656. 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"
  657. compile "$DEFAULT"
  658. ;;
  659. nios2)
  660. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  661. compile "$DEFAULT"
  662. ;;
  663. or1k)
  664. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  665. compile "$DEFAULT"
  666. ;;
  667. ppc)
  668. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  669. compile "$DEFAULT"
  670. ;;
  671. ppcsf)
  672. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  673. compile "$DEFAULT"
  674. ;;
  675. ppc64)
  676. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  677. compile "$DEFAULT"
  678. ;;
  679. sh)
  680. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  681. compile "$DEFAULT"
  682. ;;
  683. sheb)
  684. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  685. compile "$DEFAULT"
  686. ;;
  687. tile)
  688. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  689. compile "$DEFAULT"
  690. ;;
  691. *)
  692. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  693. compile "$DEFAULT"
  694. ;;
  695. esac
  696. if [ $? -ne 0 ];then
  697. echo "build failed"
  698. exit 1
  699. fi
  700. cd ..
  701. }
  702. for lib in ${libc}; do
  703. case $lib in
  704. uclibc-ng)
  705. archlist=$arch_list_uclibcng
  706. version=1.0.8
  707. gitversion=git
  708. if [ $git -eq 1 ]; then
  709. libver=uClibc-ng-${gitversion}
  710. else
  711. libver=uClibc-ng-${version}
  712. fi
  713. libdir=uClibc-ng
  714. ;;
  715. glibc)
  716. archlist=$arch_list_glibc
  717. version=2.22
  718. gitversion=2.22.90
  719. if [ $git -eq 1 ]; then
  720. libver=glibc-${gitversion}
  721. else
  722. libver=glibc-${version}
  723. fi
  724. libdir=glibc
  725. ;;
  726. musl)
  727. archlist=$arch_list_musl
  728. version=1.1.11
  729. gitversion=git
  730. if [ $git -eq 1 ]; then
  731. libver=musl-${gitversion}
  732. else
  733. libver=musl-${version}
  734. fi
  735. libdir=musl
  736. ;;
  737. esac
  738. if [ ! -z $archtolist ]; then
  739. archlist="$archtolist"
  740. fi
  741. if [ ! -z $source ]; then
  742. if [ ! -d $source ]; then
  743. echo "Not a directory."
  744. exit 1
  745. fi
  746. if [ $fast -eq 0 ]; then
  747. usrc=$(mktemp -d /tmp/XXXX)
  748. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  749. cp -a $source $usrc/$libver
  750. mkdir -p $topdir/openadk/dl 2>/dev/null
  751. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  752. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  753. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  754. fi
  755. fi
  756. # start with a clean dir
  757. if [ $clean -eq 1 ]; then
  758. (cd openadk && make cleandir)
  759. fi
  760. echo "Architectures to test: $archlist"
  761. for arch in ${archlist}; do
  762. if [ $break -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" ]; then
  763. echo "Skipping this test after last build break"
  764. continue
  765. fi
  766. echo "Compiling base system and toolchain for $lib and $arch"
  767. build $lib $arch notest
  768. if [ ! -z "$tests" ];then
  769. for test in ${tests}; do
  770. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" -o $test = "mksh" ];then
  771. case $lib in
  772. uclibc-ng)
  773. case $arch in
  774. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  775. echo "runtime tests disabled for $arch."
  776. ;;
  777. *)
  778. build $lib $arch $test
  779. runtest $lib $arch $test
  780. ;;
  781. esac
  782. ;;
  783. musl)
  784. case $arch in
  785. armeb|or1k|sheb)
  786. echo "runtime tests disabled for $arch."
  787. ;;
  788. *)
  789. build $lib $arch $test
  790. runtest $lib $arch $test
  791. ;;
  792. esac
  793. ;;
  794. glibc)
  795. case $arch in
  796. armeb|m68k|nios2|sheb|sparc64|tile)
  797. echo "runtime tests disabled for $arch."
  798. ;;
  799. *)
  800. build $lib $arch $test
  801. runtest $lib $arch $test
  802. ;;
  803. esac
  804. ;;
  805. esac
  806. else
  807. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  808. exit 1
  809. fi
  810. done
  811. fi
  812. done
  813. done
  814. echo "All tests finished."
  815. exit 0