embedded-test.sh 21 KB

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