embedded-test.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  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. # ppc qemu startup has problems. unclear why.
  28. # uClibc-ng
  29. arch_list_uclibcng_quick="arm arc avr32 bfin crisv10 m68k m68k-nommu mipsel mips64el ppcsf sh sparc x86 x86_64 xtensa"
  30. arch_list_uclibcng="arm armhf armeb arc arcbe avr32 bfin crisv10 crisv32 m68k m68k-nommu 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 ppc sh x86 x86_64"
  33. arch_list_musl="aarch64 arm armhf armeb microblazeel microblazebe mips mipssf mipsel mipselsf ppc sh sheb x86 x86_64"
  34. # glibc
  35. arch_list_glibc_quick="aarch64 arm m68k microblazeel mipsel mips64eln64 nios2 ppcsf ppc64 sh sparc sparc64 tile x86 x86_64"
  36. arch_list_glibc="aarch64 arm armhf armeb m68k 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=time.fu-berlin.de
  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. qemu_append="ntp_server=$ntp"
  153. if [ $debug -eq 0 ];then
  154. qemu_append="$qemu_append quiet"
  155. fi
  156. if [ $shell -eq 1 ];then
  157. qemu_append="$qemu_append shell"
  158. fi
  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. ;;
  287. powerpc64|ppc64)
  288. cpu_arch=ppc64
  289. qemu=qemu-system-${cpu_arch}
  290. qemu_machine=pseries
  291. ;;
  292. sh)
  293. cpu_arch=sh4
  294. qemu=qemu-system-${cpu_arch}
  295. qemu_machine=r2d
  296. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  297. ;;
  298. sheb)
  299. cpu_arch=sh4eb
  300. march=sh
  301. qemu=qemu-system-${cpu_arch}
  302. qemu_machine=r2d
  303. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  304. ;;
  305. sparc)
  306. cpu_arch=sparc
  307. qemu_machine=SS-5
  308. ;;
  309. sparc64)
  310. cpu_arch=sparc64
  311. qemu_machine=sun4u
  312. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  313. ;;
  314. x86)
  315. cpu_arch=i686
  316. qemu=qemu-system-i386
  317. qemu_machine=pc
  318. qemu_args="${qemu_args}"
  319. ;;
  320. x86_64)
  321. cpu_arch=x86_64
  322. qemu_machine=pc
  323. libdir=lib64
  324. ;;
  325. x86_64_x32)
  326. cpu_arch=x86_64
  327. qemu=qemu-system-${cpu_arch}
  328. qemu_machine=pc
  329. libdir=libx32
  330. ;;
  331. xtensa)
  332. cpu_arch=xtensa
  333. qemu=qemu-system-${cpu_arch}
  334. qemu_machine=lx60
  335. qemu_args="${qemu_args} -cpu dc233c"
  336. ;;
  337. *)
  338. echo "architecture ${arch} not supported"; exit 1;;
  339. esac
  340. if ! which $qemu >/dev/null; then
  341. echo "Checking if $qemu is installed... failed"
  342. exit 1
  343. fi
  344. qemuver=$(${qemu} -version|awk '{ print $4 }')
  345. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  346. echo "Your qemu version is too old. Please update to 2.1 or greater"
  347. exit 1
  348. fi
  349. echo "Starting test for $lib and $arch"
  350. echo "Generating root filesystem for test run"
  351. root=$(mktemp -d /tmp/XXXX)
  352. if [ ! -z $suffix ]; then
  353. archive=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  354. kernel=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  355. else
  356. archive=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  357. kernel=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}/qemu-${march}-initramfsarchive-kernel
  358. fi
  359. if [ ! -f $archive ];then
  360. echo "No root filesystem available for architecture ${arch} tried $archive"
  361. exit 1
  362. fi
  363. tar -xf $archive -C $root
  364. if [ $test = "boot" ];then
  365. cat > ${root}/run.sh << EOF
  366. #!/bin/sh
  367. uname -a
  368. rdate -n \$ntp_server
  369. file /bin/busybox
  370. for i in \$(ls /lib/*.so|grep -v libgcc);do
  371. size \$i
  372. done
  373. exit
  374. EOF
  375. fi
  376. if [ $test = "ltp" ];then
  377. cat > ${root}/run.sh << EOF
  378. #!/bin/sh
  379. uname -a
  380. rdate -n \$ntp_server
  381. /opt/ltp/runltp
  382. exit
  383. EOF
  384. fi
  385. if [ $test = "libc" ];then
  386. case $lib in
  387. uclibc-ng)
  388. cat > ${root}/run.sh << EOF
  389. #!/bin/sh
  390. uname -a
  391. rdate -n \$ntp_server
  392. cd /opt/*/test
  393. sh ./uclibcng-testrunner.sh
  394. exit
  395. EOF
  396. ;;
  397. musl|glibc)
  398. cat > ${root}/run.sh << EOF
  399. #!/bin/sh
  400. uname -a
  401. rdate -n \$ntp_server
  402. cd /opt/libc-test
  403. 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. echo "Now running the test ${test} in qemu for architecture ${arch} and ${lib}"
  414. echo "${qemu} -M ${qemu_machine} ${qemu_args} -append ${qemu_append} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch}"
  415. ${qemu} -M ${qemu_machine} ${qemu_args} -append "${qemu_append}" -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic -initrd initramfs.${arch} | tee REPORT.${arch}.${test}.${libver}
  416. if [ $? -eq 0 ];then
  417. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  418. echo
  419. else
  420. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  421. echo
  422. fi
  423. }
  424. compile() {
  425. rm .config* .defconfig 2>/dev/null
  426. make $1 defconfig
  427. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  428. make $1 all
  429. }
  430. build() {
  431. lib=$1
  432. arch=$2
  433. test=$3
  434. cd openadk
  435. make prereq
  436. # always trigger regeneration of kernel config
  437. rm build_*_${lib}_${arch}*/linux/.config > /dev/null 2>&1
  438. # download and rebuild C library package
  439. if [ $fast -eq 0 ];then
  440. make package=$lib clean > /dev/null 2>&1
  441. fi
  442. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive"
  443. if [ $debug -eq 1 ];then
  444. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  445. fi
  446. if [ $git -eq 1 ];then
  447. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  448. fi
  449. if [ $test = "boot" ];then
  450. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  451. fi
  452. if [ $test = "ltp" ];then
  453. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  454. fi
  455. if [ $test = "libc" ];then
  456. case $lib in
  457. uclibc-ng)
  458. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  459. ;;
  460. glibc)
  461. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  462. ;;
  463. musl)
  464. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  465. ;;
  466. esac
  467. fi
  468. if [ $test = "native" ];then
  469. case $lib in
  470. uclibc-ng)
  471. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  472. ;;
  473. musl)
  474. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  475. ;;
  476. glibc)
  477. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  478. ;;
  479. esac
  480. fi
  481. case $arch in
  482. aarch64)
  483. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  484. compile "$DEFAULT"
  485. ;;
  486. arc)
  487. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  488. compile "$DEFAULT"
  489. ;;
  490. arcbe)
  491. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  492. compile "$DEFAULT"
  493. ;;
  494. arm)
  495. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=little"
  496. compile "$DEFAULT"
  497. ;;
  498. armeb)
  499. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  500. compile "$DEFAULT"
  501. ;;
  502. armhf)
  503. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=little"
  504. compile "$DEFAULT"
  505. ;;
  506. avr32)
  507. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  508. compile "$DEFAULT"
  509. ;;
  510. bfin)
  511. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  512. compile "$DEFAULT"
  513. ;;
  514. c6x)
  515. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=toolchain-c6x"
  516. compile "$DEFAULT"
  517. ;;
  518. crisv10)
  519. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  520. compile "$DEFAULT"
  521. ;;
  522. crisv32)
  523. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv32"
  524. compile "$DEFAULT"
  525. ;;
  526. m68k)
  527. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  528. compile "$DEFAULT"
  529. ;;
  530. m68k-nommu)
  531. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  532. compile "$DEFAULT"
  533. ;;
  534. microblazebe)
  535. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=big"
  536. compile "$DEFAULT"
  537. ;;
  538. microblazeel)
  539. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=little"
  540. compile "$DEFAULT"
  541. ;;
  542. mips)
  543. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard"
  544. compile "$DEFAULT"
  545. ;;
  546. mipssf)
  547. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft"
  548. compile "$DEFAULT"
  549. ;;
  550. mipsel)
  551. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard"
  552. compile "$DEFAULT"
  553. ;;
  554. mipselsf)
  555. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft"
  556. compile "$DEFAULT"
  557. ;;
  558. mips64)
  559. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  560. compile "$DEFAULT"
  561. ;;
  562. mips64n32)
  563. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  564. compile "$DEFAULT"
  565. ;;
  566. mips64n64)
  567. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  568. compile "$DEFAULT"
  569. ;;
  570. mips64el)
  571. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  572. compile "$DEFAULT"
  573. ;;
  574. mips64eln32)
  575. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  576. compile "$DEFAULT"
  577. ;;
  578. mips64eln64)
  579. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  580. compile "$DEFAULT"
  581. ;;
  582. nios2)
  583. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=toolchain-nios2"
  584. compile "$DEFAULT"
  585. ;;
  586. ppc)
  587. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_FLOAT=hard"
  588. compile "$DEFAULT"
  589. ;;
  590. ppcsf)
  591. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_FLOAT=soft"
  592. compile "$DEFAULT"
  593. ;;
  594. sh)
  595. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  596. compile "$DEFAULT"
  597. ;;
  598. sheb)
  599. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  600. compile "$DEFAULT"
  601. ;;
  602. tile)
  603. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  604. compile "$DEFAULT"
  605. ;;
  606. *)
  607. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  608. compile "$DEFAULT"
  609. ;;
  610. esac
  611. if [ $? -ne 0 ];then
  612. echo "build failed"
  613. exit 1
  614. fi
  615. cd ..
  616. }
  617. for lib in ${libc}; do
  618. case $lib in
  619. uclibc-ng)
  620. if [ $quick -eq 1 ]; then
  621. archlist=$arch_list_uclibcng_quick
  622. else
  623. archlist=$arch_list_uclibcng
  624. fi
  625. version=1.0.2
  626. gitversion=git
  627. if [ $git -eq 1 ]; then
  628. libver=uClibc-ng-${gitversion}
  629. else
  630. libver=uClibc-ng-${version}
  631. fi
  632. libdir=uClibc-ng
  633. ;;
  634. glibc)
  635. if [ $quick -eq 1 ]; then
  636. archlist=$arch_list_glibc_quick
  637. else
  638. archlist=$arch_list_glibc
  639. fi
  640. version=2.21
  641. gitversion=2.21.90
  642. if [ $git -eq 1 ]; then
  643. libver=glibc-${gitversion}
  644. else
  645. libver=glibc-${version}
  646. fi
  647. libdir=glibc
  648. ;;
  649. musl)
  650. if [ $quick -eq 1 ]; then
  651. archlist=$arch_list_musl_quick
  652. else
  653. archlist=$arch_list_musl
  654. fi
  655. version=1.1.9
  656. gitversion=git
  657. if [ $git -eq 1 ]; then
  658. libver=musl-${gitversion}
  659. else
  660. libver=musl-${version}
  661. fi
  662. libdir=musl
  663. ;;
  664. esac
  665. if [ ! -z $archtolist ]; then
  666. archlist="$archtolist"
  667. fi
  668. if [ ! -z $source ]; then
  669. if [ ! -d $source ]; then
  670. echo "Not a directory."
  671. exit 1
  672. fi
  673. if [ $fast -eq 0 ]; then
  674. usrc=$(mktemp -d /tmp/XXXX)
  675. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  676. cp -a $source $usrc/$libver
  677. mkdir -p $topdir/openadk/dl 2>/dev/null
  678. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  679. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  680. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  681. fi
  682. fi
  683. echo "Architectures to test: $archlist"
  684. for arch in ${archlist}; do
  685. # start with a clean dir
  686. if [ $clean -eq 1 ]; then
  687. (cd openadk && make cleandir)
  688. fi
  689. if [ $break -eq 1 -a -f "REPORT.${arch}.${lib}.${tests}.${version}" ]; then
  690. echo "Skipping this test after last build break"
  691. continue
  692. fi
  693. echo "Compiling base system and toolchain for $lib and $arch"
  694. build $lib $arch notest
  695. if [ ! -z "$tests" ];then
  696. for test in ${tests}; do
  697. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  698. case $lib in
  699. uclibc-ng)
  700. case $arch in
  701. arc|arcbe|armeb|avr32|bfin|c6x|crisv10|crisv32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|ppc|sheb|mips64eln32|mips64n32)
  702. echo "runtime tests disabled for $arch."
  703. ;;
  704. *)
  705. build $lib $arch $test
  706. runtest $lib $arch $test
  707. ;;
  708. esac
  709. ;;
  710. musl)
  711. case $arch in
  712. armeb|ppc|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. glibc)
  722. case $arch in
  723. armeb|m68k|nios2|ppc|sheb|sparc64|tile)
  724. echo "runtime tests disabled for $arch."
  725. ;;
  726. *)
  727. build $lib $arch $test
  728. runtest $lib $arch $test
  729. ;;
  730. esac
  731. ;;
  732. esac
  733. else
  734. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  735. exit 1
  736. fi
  737. done
  738. fi
  739. done
  740. done
  741. echo "All tests finished."
  742. exit 0