embedded-test.sh 21 KB

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