embedded-test.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  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 metag 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 metag 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. qemu_machine=vexpress-a9
  171. suffix=soft_eabi
  172. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  173. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  174. ;;
  175. armhf)
  176. cpu_arch=arm
  177. march=arm
  178. qemu=qemu-system-${cpu_arch}
  179. qemu_machine=vexpress-a9
  180. suffix=hard_eabihf
  181. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  182. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  183. ;;
  184. microblazeel)
  185. cpu_arch=microblazeel
  186. march=microblaze
  187. qemu_machine=petalogix-s3adsp1800
  188. ;;
  189. microblazebe)
  190. cpu_arch=microblaze
  191. march=microblaze
  192. qemu=qemu-system-${march}
  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
  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
  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. # download and rebuild C library package
  442. if [ $fast -eq 0 ];then
  443. make package=$lib clean > /dev/null 2>&1
  444. fi
  445. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive"
  446. if [ $debug -eq 1 ];then
  447. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  448. fi
  449. if [ $git -eq 1 ];then
  450. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  451. fi
  452. if [ $test = "boot" ];then
  453. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  454. fi
  455. if [ $test = "ltp" ];then
  456. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  457. fi
  458. if [ $test = "libc" ];then
  459. case $lib in
  460. uclibc-ng)
  461. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  462. ;;
  463. glibc)
  464. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  465. ;;
  466. musl)
  467. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  468. ;;
  469. esac
  470. fi
  471. if [ $test = "native" ];then
  472. case $lib in
  473. uclibc-ng)
  474. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  475. ;;
  476. musl)
  477. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  478. ;;
  479. glibc)
  480. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  481. ;;
  482. esac
  483. fi
  484. case $arch in
  485. aarch64)
  486. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  487. compile "$DEFAULT"
  488. ;;
  489. arc)
  490. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  491. compile "$DEFAULT"
  492. ;;
  493. arcbe)
  494. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  495. compile "$DEFAULT"
  496. ;;
  497. arm)
  498. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=little"
  499. compile "$DEFAULT"
  500. ;;
  501. armeb)
  502. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  503. compile "$DEFAULT"
  504. ;;
  505. armhf)
  506. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=little"
  507. compile "$DEFAULT"
  508. ;;
  509. avr32)
  510. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  511. compile "$DEFAULT"
  512. ;;
  513. bfin)
  514. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  515. compile "$DEFAULT"
  516. ;;
  517. c6x)
  518. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=toolchain-c6x"
  519. compile "$DEFAULT"
  520. ;;
  521. crisv10)
  522. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  523. compile "$DEFAULT"
  524. ;;
  525. crisv32)
  526. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv32"
  527. compile "$DEFAULT"
  528. ;;
  529. m68k)
  530. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k ADK_TARGET_QEMU=q800"
  531. compile "$DEFAULT"
  532. ;;
  533. m68k-nommu)
  534. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k ADK_TARGET_QEMU=mcf5208"
  535. compile "$DEFAULT"
  536. ;;
  537. metag)
  538. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_SYSTEM=toolchain-metag"
  539. compile "$DEFAULT"
  540. ;;
  541. microblazebe)
  542. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=big"
  543. compile "$DEFAULT"
  544. ;;
  545. microblazeel)
  546. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=little"
  547. compile "$DEFAULT"
  548. ;;
  549. mips)
  550. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard"
  551. compile "$DEFAULT"
  552. ;;
  553. mipssf)
  554. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft"
  555. compile "$DEFAULT"
  556. ;;
  557. mipsel)
  558. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard"
  559. compile "$DEFAULT"
  560. ;;
  561. mipselsf)
  562. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft"
  563. compile "$DEFAULT"
  564. ;;
  565. mips64)
  566. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  567. compile "$DEFAULT"
  568. ;;
  569. mips64n32)
  570. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  571. compile "$DEFAULT"
  572. ;;
  573. mips64n64)
  574. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  575. compile "$DEFAULT"
  576. ;;
  577. mips64el)
  578. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  579. compile "$DEFAULT"
  580. ;;
  581. mips64eln32)
  582. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  583. compile "$DEFAULT"
  584. ;;
  585. mips64eln64)
  586. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  587. compile "$DEFAULT"
  588. ;;
  589. nios2)
  590. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=toolchain-nios2"
  591. compile "$DEFAULT"
  592. ;;
  593. or1k)
  594. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_SYSTEM=toolchain-or1k"
  595. compile "$DEFAULT"
  596. ;;
  597. ppc)
  598. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_QEMU=macppc ADK_TARGET_FLOAT=hard"
  599. compile "$DEFAULT"
  600. ;;
  601. ppcsf)
  602. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_QEMU=bamboo ADK_TARGET_FLOAT=soft"
  603. compile "$DEFAULT"
  604. ;;
  605. sh)
  606. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  607. compile "$DEFAULT"
  608. ;;
  609. sheb)
  610. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  611. compile "$DEFAULT"
  612. ;;
  613. tile)
  614. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  615. compile "$DEFAULT"
  616. ;;
  617. *)
  618. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  619. compile "$DEFAULT"
  620. ;;
  621. esac
  622. if [ $? -ne 0 ];then
  623. echo "build failed"
  624. exit 1
  625. fi
  626. cd ..
  627. }
  628. for lib in ${libc}; do
  629. case $lib in
  630. uclibc-ng)
  631. if [ $quick -eq 1 ]; then
  632. archlist=$arch_list_uclibcng_quick
  633. else
  634. archlist=$arch_list_uclibcng
  635. fi
  636. version=1.0.5
  637. gitversion=git
  638. if [ $git -eq 1 ]; then
  639. libver=uClibc-ng-${gitversion}
  640. else
  641. libver=uClibc-ng-${version}
  642. fi
  643. libdir=uClibc-ng
  644. ;;
  645. glibc)
  646. if [ $quick -eq 1 ]; then
  647. archlist=$arch_list_glibc_quick
  648. else
  649. archlist=$arch_list_glibc
  650. fi
  651. version=2.22
  652. gitversion=2.22.90
  653. if [ $git -eq 1 ]; then
  654. libver=glibc-${gitversion}
  655. else
  656. libver=glibc-${version}
  657. fi
  658. libdir=glibc
  659. ;;
  660. musl)
  661. if [ $quick -eq 1 ]; then
  662. archlist=$arch_list_musl_quick
  663. else
  664. archlist=$arch_list_musl
  665. fi
  666. version=1.1.10
  667. gitversion=git
  668. if [ $git -eq 1 ]; then
  669. libver=musl-${gitversion}
  670. else
  671. libver=musl-${version}
  672. fi
  673. libdir=musl
  674. ;;
  675. esac
  676. if [ ! -z $archtolist ]; then
  677. archlist="$archtolist"
  678. fi
  679. if [ ! -z $source ]; then
  680. if [ ! -d $source ]; then
  681. echo "Not a directory."
  682. exit 1
  683. fi
  684. if [ $fast -eq 0 ]; then
  685. usrc=$(mktemp -d /tmp/XXXX)
  686. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  687. cp -a $source $usrc/$libver
  688. mkdir -p $topdir/openadk/dl 2>/dev/null
  689. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  690. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  691. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  692. fi
  693. fi
  694. echo "Architectures to test: $archlist"
  695. for arch in ${archlist}; do
  696. # start with a clean dir
  697. if [ $clean -eq 1 ]; then
  698. (cd openadk && make cleandir)
  699. fi
  700. if [ $break -eq 1 -a -f "REPORT.${arch}.${lib}.${tests}.${version}" ]; then
  701. echo "Skipping this test after last build break"
  702. continue
  703. fi
  704. echo "Compiling base system and toolchain for $lib and $arch"
  705. build $lib $arch notest
  706. if [ ! -z "$tests" ];then
  707. for test in ${tests}; do
  708. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  709. case $lib in
  710. uclibc-ng)
  711. case $arch in
  712. arc|arcbe|armeb|avr32|bfin|c6x|crisv10|crisv32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|sheb)
  713. echo "runtime tests disabled for $arch."
  714. ;;
  715. *)
  716. build $lib $arch $test
  717. runtest $lib $arch $test
  718. ;;
  719. esac
  720. ;;
  721. musl)
  722. case $arch in
  723. armeb|sheb)
  724. echo "runtime tests disabled for $arch."
  725. ;;
  726. *)
  727. build $lib $arch $test
  728. runtest $lib $arch $test
  729. ;;
  730. esac
  731. ;;
  732. glibc)
  733. case $arch in
  734. armeb|m68k|nios2|sheb|sparc64|tile)
  735. echo "runtime tests disabled for $arch."
  736. ;;
  737. *)
  738. build $lib $arch $test
  739. runtest $lib $arch $test
  740. ;;
  741. esac
  742. ;;
  743. esac
  744. else
  745. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  746. exit 1
  747. fi
  748. done
  749. fi
  750. done
  751. done
  752. echo "All tests finished."
  753. exit 0