embedded-test.sh 23 KB

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