embedded-test.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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. # m68k glibc toolchain building is broken at the moment
  29. # uClibc-ng
  30. arch_list_uclibcng_quick="arm arc avr32 bfin crisv10 m68k m68k-nommu mipsel mips64el ppcsf sh sparc x86 x86_64 xtensa"
  31. 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"
  32. # musl
  33. arch_list_musl_quick="aarch64 arm microblazeel mipsel ppc sh x86 x86_64"
  34. arch_list_musl="aarch64 arm armhf armeb microblazeel microblazebe mips mipssf mipsel mipselsf ppc sh sheb x86 x86_64"
  35. # glibc
  36. arch_list_glibc_quick="aarch64 arm microblazeel mipsel mips64eln64 nios2 ppcsf ppc64 sh sparc sparc64 tile x86 x86_64"
  37. 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"
  38. topdir=$(pwd)
  39. openadk_git=http://git.openadk.org/openadk.git
  40. tools='make git wget xz cpio tar awk sed'
  41. f=0
  42. for tool in $tools; do
  43. if ! which $tool >/dev/null; then
  44. echo "Checking if $tool is installed... failed"
  45. f=1
  46. fi
  47. done
  48. if [ $f -eq 1 ];then exit 1; fi
  49. help() {
  50. cat >&2 <<EOF
  51. Syntax: $0 [ -l <libc> -a <arch> -t <tests> ]
  52. Explanation:
  53. -l: c library to use (uclibc-ng|musl|glibc)
  54. -g: use latest git version of C library
  55. -a: architecture to check (otherwise all supported)
  56. -u: update openadk source via git pull, before building
  57. -s: use directory with source for C library
  58. -f: enable fast compile, after a failure no rebuild
  59. -d: enable debug output from OpenADK
  60. -c: clean OpenADK build directory before build
  61. -m: start a shell in Qemu system for manual testing
  62. -n: set NTP server for test run
  63. -p: add extra packages to build
  64. -q: use quick mode (no endian|abi|float combinations)
  65. -t: run tests (boot|libc|ltp|native)
  66. -h: help text
  67. EOF
  68. }
  69. break=0
  70. clean=0
  71. shell=0
  72. update=0
  73. debug=0
  74. git=0
  75. fast=0
  76. quick=0
  77. ntp=time.fu-berlin.de
  78. while getopts "bhfgumdqcn:a:s:l:t:p:" ch; do
  79. case $ch in
  80. m)
  81. shell=1
  82. ;;
  83. g)
  84. git=1
  85. ;;
  86. b)
  87. break=1
  88. ;;
  89. c)
  90. clean=1
  91. ;;
  92. d)
  93. debug=1
  94. ;;
  95. f)
  96. fast=1
  97. ;;
  98. q)
  99. quick=1
  100. ;;
  101. u)
  102. update=1
  103. ;;
  104. s)
  105. source=$OPTARG
  106. ;;
  107. l)
  108. libc=$OPTARG
  109. ;;
  110. n)
  111. ntp=$OPTARG
  112. ;;
  113. a)
  114. archtolist=$OPTARG
  115. ;;
  116. p)
  117. pkgs=$OPTARG
  118. ;;
  119. t)
  120. tests=$OPTARG
  121. ;;
  122. h)
  123. help
  124. exit 1
  125. ;;
  126. esac
  127. done
  128. shift $((OPTIND - 1))
  129. if [ -z "$libc" ];then
  130. libc="uclibc-ng musl glibc"
  131. fi
  132. if [ ! -d openadk ];then
  133. git clone $openadk_git
  134. if [ $? -ne 0 ];then
  135. echo "Cloning from $openadk_git failed."
  136. exit 1
  137. fi
  138. else
  139. if [ $update -eq 1 ];then
  140. (cd openadk && git pull)
  141. if [ $? -ne 0 ];then
  142. echo "Updating from $openadk_git failed."
  143. exit 1
  144. fi
  145. fi
  146. fi
  147. runtest() {
  148. lib=$1
  149. arch=$2
  150. test=$3
  151. qemu=qemu-system-${arch}
  152. qemu_args=
  153. qemu_append="ntp_server=$ntp"
  154. if [ $debug -eq 0 ];then
  155. qemu_append="$qemu_append quiet"
  156. fi
  157. if [ $shell -eq 1 ];then
  158. qemu_append="$qemu_append shell"
  159. fi
  160. suffix=
  161. libdir=lib
  162. march=${arch}
  163. case ${arch} in
  164. aarch64)
  165. cpu_arch=aarch64
  166. qemu_machine=virt
  167. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  168. ;;
  169. arm)
  170. cpu_arch=arm
  171. qemu_machine=vexpress-a9
  172. suffix=soft_eabi
  173. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  174. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  175. ;;
  176. armhf)
  177. cpu_arch=arm
  178. march=arm
  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
  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
  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. ;;
  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. if [ $test = "boot" ];then
  366. cat > ${root}/run.sh << EOF
  367. #!/bin/sh
  368. uname -a
  369. rdate -n \$ntp_server
  370. file /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. #!/bin/sh
  380. uname -a
  381. rdate -n \$ntp_server
  382. /opt/ltp/runltp
  383. exit
  384. EOF
  385. fi
  386. if [ $test = "libc" ];then
  387. case $lib in
  388. uclibc-ng)
  389. cat > ${root}/run.sh << EOF
  390. #!/bin/sh
  391. uname -a
  392. rdate -n \$ntp_server
  393. cd /opt/*/test
  394. sh ./uclibcng-testrunner.sh
  395. exit
  396. EOF
  397. ;;
  398. musl|glibc)
  399. cat > ${root}/run.sh << EOF
  400. #!/bin/sh
  401. uname -a
  402. rdate -n \$ntp_server
  403. cd /opt/libc-test
  404. make run
  405. exit
  406. EOF
  407. ;;
  408. esac
  409. fi
  410. chmod u+x ${root}/run.sh
  411. echo "Creating initramfs filesystem"
  412. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  413. rm -rf $root
  414. echo "Now running the test ${test} in qemu for architecture ${arch} and ${lib}"
  415. 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}"
  416. ${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}
  417. if [ $? -eq 0 ];then
  418. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  419. echo
  420. else
  421. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  422. echo
  423. fi
  424. }
  425. compile() {
  426. rm .config* .defconfig 2>/dev/null
  427. make $1 defconfig
  428. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  429. make $1 all
  430. }
  431. build() {
  432. lib=$1
  433. arch=$2
  434. test=$3
  435. cd openadk
  436. make prereq
  437. # always trigger regeneration of kernel config
  438. rm build_*_${lib}_${arch}*/linux/.config > /dev/null 2>&1
  439. # download and rebuild C library package
  440. if [ $fast -eq 0 ];then
  441. make package=$lib clean > /dev/null 2>&1
  442. fi
  443. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive"
  444. if [ $debug -eq 1 ];then
  445. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  446. fi
  447. if [ $git -eq 1 ];then
  448. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  449. fi
  450. if [ $test = "boot" ];then
  451. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  452. fi
  453. if [ $test = "ltp" ];then
  454. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  455. fi
  456. if [ $test = "libc" ];then
  457. case $lib in
  458. uclibc-ng)
  459. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  460. ;;
  461. glibc)
  462. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  463. ;;
  464. musl)
  465. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  466. ;;
  467. esac
  468. fi
  469. if [ $test = "native" ];then
  470. case $lib in
  471. uclibc-ng)
  472. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  473. ;;
  474. musl)
  475. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  476. ;;
  477. glibc)
  478. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  479. ;;
  480. esac
  481. fi
  482. case $arch in
  483. aarch64)
  484. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  485. compile "$DEFAULT"
  486. ;;
  487. arc)
  488. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  489. compile "$DEFAULT"
  490. ;;
  491. arcbe)
  492. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  493. compile "$DEFAULT"
  494. ;;
  495. arm)
  496. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=little"
  497. compile "$DEFAULT"
  498. ;;
  499. armeb)
  500. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  501. compile "$DEFAULT"
  502. ;;
  503. armhf)
  504. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=little"
  505. compile "$DEFAULT"
  506. ;;
  507. avr32)
  508. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  509. compile "$DEFAULT"
  510. ;;
  511. bfin)
  512. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  513. compile "$DEFAULT"
  514. ;;
  515. c6x)
  516. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=toolchain-c6x"
  517. compile "$DEFAULT"
  518. ;;
  519. crisv10)
  520. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  521. compile "$DEFAULT"
  522. ;;
  523. crisv32)
  524. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv32"
  525. compile "$DEFAULT"
  526. ;;
  527. m68k)
  528. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  529. compile "$DEFAULT"
  530. ;;
  531. m68k-nommu)
  532. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  533. compile "$DEFAULT"
  534. ;;
  535. microblazebe)
  536. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=big"
  537. compile "$DEFAULT"
  538. ;;
  539. microblazeel)
  540. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=little"
  541. compile "$DEFAULT"
  542. ;;
  543. mips)
  544. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard"
  545. compile "$DEFAULT"
  546. ;;
  547. mipssf)
  548. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft"
  549. compile "$DEFAULT"
  550. ;;
  551. mipsel)
  552. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard"
  553. compile "$DEFAULT"
  554. ;;
  555. mipselsf)
  556. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft"
  557. compile "$DEFAULT"
  558. ;;
  559. mips64)
  560. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  561. compile "$DEFAULT"
  562. ;;
  563. mips64n32)
  564. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  565. compile "$DEFAULT"
  566. ;;
  567. mips64n64)
  568. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  569. compile "$DEFAULT"
  570. ;;
  571. mips64el)
  572. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  573. compile "$DEFAULT"
  574. ;;
  575. mips64eln32)
  576. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  577. compile "$DEFAULT"
  578. ;;
  579. mips64eln64)
  580. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  581. compile "$DEFAULT"
  582. ;;
  583. nios2)
  584. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=toolchain-nios2"
  585. compile "$DEFAULT"
  586. ;;
  587. ppc)
  588. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_QEMU=macppc ADK_TARGET_FLOAT=hard"
  589. compile "$DEFAULT"
  590. ;;
  591. ppcsf)
  592. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_QEMU=bamboo ADK_TARGET_FLOAT=soft"
  593. compile "$DEFAULT"
  594. ;;
  595. sh)
  596. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  597. compile "$DEFAULT"
  598. ;;
  599. sheb)
  600. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  601. compile "$DEFAULT"
  602. ;;
  603. tile)
  604. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  605. compile "$DEFAULT"
  606. ;;
  607. *)
  608. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  609. compile "$DEFAULT"
  610. ;;
  611. esac
  612. if [ $? -ne 0 ];then
  613. echo "build failed"
  614. exit 1
  615. fi
  616. cd ..
  617. }
  618. for lib in ${libc}; do
  619. case $lib in
  620. uclibc-ng)
  621. if [ $quick -eq 1 ]; then
  622. archlist=$arch_list_uclibcng_quick
  623. else
  624. archlist=$arch_list_uclibcng
  625. fi
  626. version=1.0.2
  627. gitversion=git
  628. if [ $git -eq 1 ]; then
  629. libver=uClibc-ng-${gitversion}
  630. else
  631. libver=uClibc-ng-${version}
  632. fi
  633. libdir=uClibc-ng
  634. ;;
  635. glibc)
  636. if [ $quick -eq 1 ]; then
  637. archlist=$arch_list_glibc_quick
  638. else
  639. archlist=$arch_list_glibc
  640. fi
  641. version=2.21
  642. gitversion=2.21.90
  643. if [ $git -eq 1 ]; then
  644. libver=glibc-${gitversion}
  645. else
  646. libver=glibc-${version}
  647. fi
  648. libdir=glibc
  649. ;;
  650. musl)
  651. if [ $quick -eq 1 ]; then
  652. archlist=$arch_list_musl_quick
  653. else
  654. archlist=$arch_list_musl
  655. fi
  656. version=1.1.9
  657. gitversion=git
  658. if [ $git -eq 1 ]; then
  659. libver=musl-${gitversion}
  660. else
  661. libver=musl-${version}
  662. fi
  663. libdir=musl
  664. ;;
  665. esac
  666. if [ ! -z $archtolist ]; then
  667. archlist="$archtolist"
  668. fi
  669. if [ ! -z $source ]; then
  670. if [ ! -d $source ]; then
  671. echo "Not a directory."
  672. exit 1
  673. fi
  674. if [ $fast -eq 0 ]; then
  675. usrc=$(mktemp -d /tmp/XXXX)
  676. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  677. cp -a $source $usrc/$libver
  678. mkdir -p $topdir/openadk/dl 2>/dev/null
  679. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  680. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  681. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  682. fi
  683. fi
  684. echo "Architectures to test: $archlist"
  685. for arch in ${archlist}; do
  686. # start with a clean dir
  687. if [ $clean -eq 1 ]; then
  688. (cd openadk && make cleandir)
  689. fi
  690. if [ $break -eq 1 -a -f "REPORT.${arch}.${lib}.${tests}.${version}" ]; then
  691. echo "Skipping this test after last build break"
  692. continue
  693. fi
  694. echo "Compiling base system and toolchain for $lib and $arch"
  695. build $lib $arch notest
  696. if [ ! -z "$tests" ];then
  697. for test in ${tests}; do
  698. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  699. case $lib in
  700. uclibc-ng)
  701. case $arch in
  702. arc|arcbe|armeb|avr32|bfin|c6x|crisv10|crisv32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|ppc|sheb|mips64eln32|mips64n32)
  703. echo "runtime tests disabled for $arch."
  704. ;;
  705. *)
  706. build $lib $arch $test
  707. runtest $lib $arch $test
  708. ;;
  709. esac
  710. ;;
  711. musl)
  712. case $arch in
  713. armeb|ppc|sheb)
  714. echo "runtime tests disabled for $arch."
  715. ;;
  716. *)
  717. build $lib $arch $test
  718. runtest $lib $arch $test
  719. ;;
  720. esac
  721. ;;
  722. glibc)
  723. case $arch in
  724. armeb|m68k|nios2|ppc|sheb|sparc64|tile)
  725. echo "runtime tests disabled for $arch."
  726. ;;
  727. *)
  728. build $lib $arch $test
  729. runtest $lib $arch $test
  730. ;;
  731. esac
  732. ;;
  733. esac
  734. else
  735. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  736. exit 1
  737. fi
  738. done
  739. fi
  740. done
  741. done
  742. echo "All tests finished."
  743. exit 0