embedded-test.sh 21 KB

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