embedded-test.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. #!/usr/bin/env mksh
  2. #
  3. # Copyright © 2014-2015
  4. # Waldemar Brodkorb <wbx@embedded-test.org>
  5. #
  6. # Provided that these terms and disclaimer and all copyright notices
  7. # are retained or reproduced in an accompanying document, permission
  8. # is granted to deal in this work without restriction, including un‐
  9. # limited rights to use, publicly perform, distribute, sell, modify,
  10. # merge, give away, or sublicence.
  11. #
  12. # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
  13. # the utmost extent permitted by applicable law, neither express nor
  14. # implied; without malicious intent or gross negligence. In no event
  15. # may a licensor, author or contributor be held liable for indirect,
  16. # direct, other damage, loss, or other issues arising in any way out
  17. # of dealing in the work, even if advised of the possibility of such
  18. # damage or existence of a defect, except proven that it results out
  19. # of said person’s immediate fault when using the work as intended.
  20. #
  21. # Alternatively, this work may be distributed under the Terms of the
  22. # General Public License, any version as published by the Free Soft‐
  23. # ware Foundation.
  24. # architecture specific notes:
  25. # sheb network card get no ip
  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. giturl=http://git.openadk.org/openadk.git
  35. valid_libc="uclibc-ng musl glibc"
  36. valid_tests="boot libc ltp mksh native"
  37. tools='make git wget xz cpio tar awk sed'
  38. f=0
  39. for tool in $tools; do
  40. if ! which $tool >/dev/null; then
  41. echo "Checking if $tool is installed... failed"
  42. f=1
  43. fi
  44. done
  45. if [ $f -eq 1 ];then exit 1; fi
  46. help() {
  47. cat >&2 <<EOF
  48. Syntax: $0 [ --libc=<libc> --arch=<arch> --tests=<tests> ]
  49. Explanation:
  50. --libc=<libc> c library to use (${valid_libc})
  51. --arch=<arch> architecture to check (otherwise all supported)
  52. --tests=<tests> run tests (${valid_tests})
  53. --source=<dir> use directory with source for C library
  54. --ntp=<ntpserver> set NTP server for test run
  55. --packages=<packagelist> add extra packages to the build
  56. --update update OpenADK source via git pull, before building
  57. --clean clean OpenADK build directory before build
  58. --debug enable debug output from OpenADK
  59. --shell start a shell instead auf autorun of test
  60. --help this help text
  61. EOF
  62. exit 1
  63. }
  64. break=0
  65. clean=0
  66. shell=0
  67. update=0
  68. debug=0
  69. piggyback=0
  70. ntp=""
  71. libc=""
  72. while [[ $1 != -- && $1 = -* ]]; do case $1 {
  73. (--clean) clean=1; shift ;;
  74. (--debug) debug=1; shift ;;
  75. (--update) update=1; shift ;;
  76. (--shell) shell=1 shift ;;
  77. (--libc=*) libc=${1#*=}; shift ;;
  78. (--arch=*) archs=${1#*=}; shift ;;
  79. (--tests=*) tests=${1#*=}; shift ;;
  80. (--source=*) source=${1#*=}; shift ;;
  81. (--ntp=*) ntp=${1#*=}; shift ;;
  82. (--help) help; shift ;;
  83. (--*) echo "unknown option $1"; exit 1 ;;
  84. (-*) help ;;
  85. }; done
  86. if [ -z "$libc" ];then
  87. libc="uclibc-ng musl glibc"
  88. fi
  89. if [ ! -d openadk ];then
  90. git clone $giturl
  91. if [ $? -ne 0 ];then
  92. echo "Cloning from $giturl failed."
  93. exit 1
  94. fi
  95. else
  96. if [ $update -eq 1 ];then
  97. (cd openadk && git pull)
  98. if [ $? -ne 0 ];then
  99. echo "Updating from $giturl failed."
  100. exit 1
  101. fi
  102. fi
  103. fi
  104. runtest() {
  105. lib=$1
  106. arch=$2
  107. test=$3
  108. emulator=qemu
  109. qemu=qemu-system-${arch}
  110. qemu_args=
  111. if [ $ntp ]; then
  112. qemu_append="-append ntpserver=$ntp"
  113. fi
  114. if [ $shell -eq 1 ]; then
  115. qemu_append="-append shell"
  116. fi
  117. noappend=0
  118. piggyback=0
  119. suffix=
  120. libdir=lib
  121. march=${arch}
  122. case ${arch} in
  123. aarch64)
  124. cpu_arch=aarch64
  125. qemu_machine=virt
  126. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  127. ;;
  128. armv5)
  129. cpu_arch=arm
  130. march=arm-versatilepb
  131. qemu=qemu-system-${cpu_arch}
  132. qemu_machine=versatilepb
  133. suffix=soft_eabi
  134. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  135. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  136. ;;
  137. armv7)
  138. cpu_arch=arm
  139. march=arm-vexpress-a9
  140. qemu=qemu-system-${cpu_arch}
  141. qemu_machine=vexpress-a9
  142. suffix=hard_eabihf
  143. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  144. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  145. ;;
  146. arcv1)
  147. emulator=nsim
  148. cpu_arch=arc
  149. piggyback=1
  150. ;;
  151. arcv2)
  152. emulator=nsim
  153. cpu_arch=arc
  154. piggyback=1
  155. ;;
  156. crisv32)
  157. cpu_arch=crisv32
  158. march=cris
  159. qemu=qemu-system-${march}
  160. qemu_machine=axis-dev88
  161. piggyback=1
  162. ;;
  163. microblazeel)
  164. cpu_arch=microblazeel
  165. march=microblaze-ml605
  166. qemu_machine=petalogix-s3adsp1800
  167. ;;
  168. microblazebe)
  169. cpu_arch=microblaze
  170. march=microblaze-ml605
  171. qemu=qemu-system-${cpu_arch}
  172. qemu_machine=petalogix-s3adsp1800
  173. ;;
  174. mips)
  175. cpu_arch=mips
  176. qemu=qemu-system-${cpu_arch}
  177. qemu_machine=malta
  178. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  179. suffix=hard
  180. ;;
  181. mipssf)
  182. cpu_arch=mips
  183. march=mips
  184. qemu=qemu-system-${cpu_arch}
  185. qemu_machine=malta
  186. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  187. suffix=soft
  188. ;;
  189. mipsel)
  190. cpu_arch=mipsel
  191. march=mips
  192. qemu=qemu-system-${cpu_arch}
  193. qemu_machine=malta
  194. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  195. suffix=hard
  196. ;;
  197. mipselsf)
  198. cpu_arch=mipsel
  199. march=mips
  200. qemu=qemu-system-${cpu_arch}
  201. qemu_machine=malta
  202. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  203. suffix=soft
  204. ;;
  205. mips64)
  206. cpu_arch=mips64
  207. qemu_machine=malta
  208. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  209. suffix=o32
  210. ;;
  211. mips64n32)
  212. cpu_arch=mips64
  213. march=mips64
  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=n32
  218. ;;
  219. mips64n64)
  220. cpu_arch=mips64
  221. march=mips64
  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=n64
  226. ;;
  227. mips64el)
  228. cpu_arch=mips64el
  229. march=mips64
  230. qemu_machine=malta
  231. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  232. suffix=o32
  233. ;;
  234. mips64eln32)
  235. cpu_arch=mips64el
  236. march=mips64
  237. qemu=qemu-system-${cpu_arch}
  238. qemu_machine=malta
  239. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  240. suffix=n32
  241. ;;
  242. mips64eln64)
  243. cpu_arch=mips64el
  244. march=mips64
  245. qemu=qemu-system-${cpu_arch}
  246. qemu_machine=malta
  247. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  248. suffix=n64
  249. ;;
  250. ppcsf)
  251. cpu_arch=ppc
  252. march=ppc-bamboo
  253. qemu=qemu-system-${cpu_arch}
  254. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  255. qemu_machine=bamboo
  256. suffix=soft
  257. ;;
  258. ppc)
  259. cpu_arch=ppc
  260. march=ppc-macppc
  261. qemu=qemu-system-${cpu_arch}
  262. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  263. qemu_machine=mac99
  264. suffix=hard
  265. noappend=1
  266. ;;
  267. powerpc64|ppc64)
  268. cpu_arch=ppc64
  269. qemu=qemu-system-${cpu_arch}
  270. qemu_machine=pseries
  271. ;;
  272. sh)
  273. cpu_arch=sh4
  274. qemu=qemu-system-${cpu_arch}
  275. qemu_machine=r2d
  276. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  277. ;;
  278. sheb)
  279. cpu_arch=sh4eb
  280. march=sh
  281. qemu=qemu-system-${cpu_arch}
  282. qemu_machine=r2d
  283. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  284. ;;
  285. sparc)
  286. cpu_arch=sparc
  287. qemu_machine=SS-5
  288. ;;
  289. sparc64)
  290. cpu_arch=sparc64
  291. qemu_machine=sun4u
  292. qemu_args="${qemu_args} -net nic,model=e1000 -net user"
  293. ;;
  294. x86)
  295. cpu_arch=i686
  296. qemu=qemu-system-i386
  297. qemu_machine=pc
  298. qemu_args="${qemu_args}"
  299. ;;
  300. x86_64)
  301. cpu_arch=x86_64
  302. qemu_machine=pc
  303. libdir=lib64
  304. ;;
  305. x86_64_x32)
  306. cpu_arch=x86_64
  307. qemu=qemu-system-${cpu_arch}
  308. qemu_machine=pc
  309. libdir=libx32
  310. ;;
  311. xtensa)
  312. cpu_arch=xtensa
  313. qemu=qemu-system-${cpu_arch}
  314. qemu_machine=lx60
  315. qemu_args="${qemu_args} -cpu dc233c"
  316. ;;
  317. *)
  318. echo "architecture ${arch} not supported"; exit 1;;
  319. esac
  320. case $emulator in
  321. qemu)
  322. echo "Using QEMU as emulator"
  323. if ! which $qemu >/dev/null; then
  324. echo "Checking if $qemu is installed... failed"
  325. exit 1
  326. fi
  327. qemuver=$(${qemu} -version|awk '{ print $4 }')
  328. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  329. echo "Your qemu version is too old. Please update to 2.1 or greater"
  330. exit 1
  331. fi
  332. ;;
  333. nsim)
  334. echo "Using Synopsys NSIM as simulator"
  335. if ! which nsimdrv >/dev/null; then
  336. echo "Checking if $emulator is installed... failed"
  337. exit 1
  338. fi
  339. ;;
  340. *)
  341. echo "emulator/simulator not supported"; exit 1;;
  342. esac
  343. echo "Starting test for $lib and $arch"
  344. # check if initramfs or piggyback is used
  345. if [ $piggyback -eq 1 ]; then
  346. echo "Using extra directory for test image creation"
  347. root=openadk/extra
  348. rm -rf openadk/extra 2>/dev/null
  349. mkdir openadk/extra 2>/dev/null
  350. if [ ! -z $suffix ]; then
  351. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  352. else
  353. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  354. fi
  355. else
  356. echo "Generating root filesystem for test run"
  357. root=$(mktemp -d /tmp/XXXX)
  358. if [ ! -z $suffix ]; then
  359. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  360. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  361. else
  362. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  363. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  364. fi
  365. if [ ! -f $archive ];then
  366. echo "No root filesystem available for architecture ${arch} tried $archive"
  367. exit 1
  368. fi
  369. tar -xf $archive -C $root
  370. fi
  371. # creating test script to be run on boot
  372. cat > ${root}/run.sh << EOF
  373. #!/bin/sh
  374. uname -a
  375. if [ \$ntpserver ]; then
  376. rdate \$ntpserver
  377. else
  378. rdate time.fu-berlin.de
  379. fi
  380. EOF
  381. if [ $test = "boot" ];then
  382. cat >> ${root}/run.sh << EOF
  383. file /bin/busybox
  384. size /bin/busybox
  385. for i in \$(ls /lib/*.so|grep -v libgcc);do
  386. size \$i
  387. done
  388. exit
  389. EOF
  390. fi
  391. if [ $test = "ltp" ];then
  392. cat >> ${root}/run.sh << EOF
  393. /opt/ltp/runltp
  394. exit
  395. EOF
  396. fi
  397. if [ $test = "mksh" ];then
  398. cat >> ${root}/run.sh << EOF
  399. mksh /opt/mksh/test.sh
  400. exit
  401. EOF
  402. fi
  403. if [ $test = "libc" ];then
  404. case $lib in
  405. uclibc-ng)
  406. cat >> ${root}/run.sh << EOF
  407. cd /opt/uclibc-ng/test
  408. sh ./uclibcng-testrunner.sh
  409. exit
  410. EOF
  411. ;;
  412. musl|glibc)
  413. cat >> ${root}/run.sh << EOF
  414. cd /opt/libc-test
  415. CC=: make run
  416. exit
  417. EOF
  418. ;;
  419. esac
  420. fi
  421. chmod u+x ${root}/run.sh
  422. if [ $piggyback -eq 1 ]; then
  423. (cd openadk && make v)
  424. else
  425. echo "Creating initramfs filesystem"
  426. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  427. rm -rf $root
  428. qemu_args="$qemu_args -initrd initramfs.${arch}"
  429. fi
  430. # qemu-ppc overwrites existing commandline
  431. if [ $noappend -eq 0 ]; then
  432. qemu_args="$qemu_args ${qemu_append}"
  433. fi
  434. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  435. case $emulator in
  436. qemu)
  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. ;;
  440. nsim)
  441. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  442. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  443. ;;
  444. esac
  445. if [ $? -eq 0 ];then
  446. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  447. echo
  448. else
  449. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  450. echo
  451. fi
  452. }
  453. compile() {
  454. rm .config* .defconfig 2>/dev/null
  455. make $1 defconfig
  456. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  457. make $1 all
  458. }
  459. build() {
  460. lib=$1
  461. arch=$2
  462. test=$3
  463. cd openadk
  464. make prereq
  465. make package=$lib clean > /dev/null 2>&1
  466. DEFAULT="ADK_TARGET_LIBC=$lib"
  467. if [ $debug -eq 1 ];then
  468. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  469. fi
  470. if [ $test = "boot" ];then
  471. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  472. fi
  473. if [ $test = "ltp" ];then
  474. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  475. fi
  476. if [ $test = "mksh" ];then
  477. DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
  478. fi
  479. if [ $test = "libc" ];then
  480. case $lib in
  481. uclibc-ng)
  482. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  483. ;;
  484. glibc)
  485. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  486. ;;
  487. musl)
  488. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  489. ;;
  490. esac
  491. fi
  492. if [ $test = "native" ];then
  493. case $lib in
  494. uclibc-ng)
  495. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  496. ;;
  497. musl)
  498. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  499. ;;
  500. glibc)
  501. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  502. ;;
  503. esac
  504. fi
  505. case $arch in
  506. aarch64)
  507. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  508. compile "$DEFAULT"
  509. ;;
  510. arcv1)
  511. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  512. compile "$DEFAULT"
  513. ;;
  514. arcv2)
  515. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  516. compile "$DEFAULT"
  517. ;;
  518. arcv1-be)
  519. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  520. compile "$DEFAULT"
  521. ;;
  522. arcv2-be)
  523. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  524. compile "$DEFAULT"
  525. ;;
  526. armv5)
  527. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  528. compile "$DEFAULT"
  529. ;;
  530. armeb)
  531. 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"
  532. compile "$DEFAULT"
  533. ;;
  534. armv7)
  535. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  536. compile "$DEFAULT"
  537. ;;
  538. avr32)
  539. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  540. compile "$DEFAULT"
  541. ;;
  542. bfin)
  543. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  544. compile "$DEFAULT"
  545. ;;
  546. c6x)
  547. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  548. compile "$DEFAULT"
  549. ;;
  550. crisv10)
  551. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  552. compile "$DEFAULT"
  553. ;;
  554. crisv32)
  555. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  556. compile "$DEFAULT"
  557. ;;
  558. h8300)
  559. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  560. compile "$DEFAULT"
  561. ;;
  562. m68k)
  563. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  564. compile "$DEFAULT"
  565. ;;
  566. m68k-nommu)
  567. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  568. compile "$DEFAULT"
  569. ;;
  570. metag)
  571. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-metag"
  572. compile "$DEFAULT"
  573. ;;
  574. microblazebe)
  575. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  576. compile "$DEFAULT"
  577. ;;
  578. microblazeel)
  579. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  580. compile "$DEFAULT"
  581. ;;
  582. mips)
  583. 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"
  584. compile "$DEFAULT"
  585. ;;
  586. mipssf)
  587. 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"
  588. compile "$DEFAULT"
  589. ;;
  590. mipsel)
  591. 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"
  592. compile "$DEFAULT"
  593. ;;
  594. mipselsf)
  595. 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"
  596. compile "$DEFAULT"
  597. ;;
  598. mips64)
  599. 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"
  600. compile "$DEFAULT"
  601. ;;
  602. mips64n32)
  603. 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"
  604. compile "$DEFAULT"
  605. ;;
  606. mips64n64)
  607. 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"
  608. compile "$DEFAULT"
  609. ;;
  610. mips64el)
  611. 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"
  612. compile "$DEFAULT"
  613. ;;
  614. mips64eln32)
  615. 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"
  616. compile "$DEFAULT"
  617. ;;
  618. mips64eln64)
  619. 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"
  620. compile "$DEFAULT"
  621. ;;
  622. nios2)
  623. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  624. compile "$DEFAULT"
  625. ;;
  626. or1k)
  627. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  628. compile "$DEFAULT"
  629. ;;
  630. ppc)
  631. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  632. compile "$DEFAULT"
  633. ;;
  634. ppcsf)
  635. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  636. compile "$DEFAULT"
  637. ;;
  638. ppc64)
  639. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  640. compile "$DEFAULT"
  641. ;;
  642. sh)
  643. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  644. compile "$DEFAULT"
  645. ;;
  646. sheb)
  647. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  648. compile "$DEFAULT"
  649. ;;
  650. tile)
  651. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  652. compile "$DEFAULT"
  653. ;;
  654. *)
  655. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  656. compile "$DEFAULT"
  657. ;;
  658. esac
  659. if [ $? -ne 0 ];then
  660. echo "build failed"
  661. exit 1
  662. fi
  663. cd ..
  664. }
  665. for lib in ${libc}; do
  666. case $lib in
  667. uclibc-ng)
  668. archlist=$arch_list_uclibcng
  669. version=1.0.8
  670. libver=uClibc-ng-${version}
  671. libdir=uClibc-ng
  672. ;;
  673. glibc)
  674. archlist=$arch_list_glibc
  675. version=2.22
  676. libver=glibc-${version}
  677. libdir=glibc
  678. ;;
  679. musl)
  680. archlist=$arch_list_musl
  681. version=1.1.11
  682. libver=musl-${version}
  683. libdir=musl
  684. ;;
  685. *)
  686. echo "$lib not supported"
  687. exit 1
  688. ;;
  689. esac
  690. if [ ! -z $archs ]; then
  691. archlist="$archs"
  692. fi
  693. if [ ! -z $source ]; then
  694. if [ ! -d $source ]; then
  695. echo "Not a directory."
  696. exit 1
  697. fi
  698. if [ $fast -eq 0 ]; then
  699. usrc=$(mktemp -d /tmp/XXXX)
  700. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  701. cp -a $source $usrc/$libver
  702. mkdir -p $topdir/openadk/dl 2>/dev/null
  703. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  704. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  705. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  706. fi
  707. fi
  708. # start with a clean dir
  709. if [ $clean -eq 1 ]; then
  710. echo "cleaning openadk build directory"
  711. (cd openadk && make cleandir)
  712. fi
  713. if [ ! -z "$tests" ];then
  714. testinfo="$tests testing"
  715. else
  716. testinfo="toolchain testing"
  717. fi
  718. echo "Summary: testing $archlist with C library $lib and $testinfo"
  719. sleep 2
  720. for arch in ${archlist}; do
  721. if [ $break -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" ]; then
  722. echo "Skipping this test after last build break"
  723. continue
  724. fi
  725. echo "Compiling base system and toolchain for $lib and $arch"
  726. build $lib $arch notest
  727. if [ ! -z "$tests" ];then
  728. for test in ${tests}; do
  729. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" -o $test = "mksh" ];then
  730. case $lib in
  731. uclibc-ng)
  732. case $arch in
  733. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  734. echo "runtime tests disabled for $arch."
  735. ;;
  736. *)
  737. build $lib $arch $test
  738. runtest $lib $arch $test
  739. ;;
  740. esac
  741. ;;
  742. musl)
  743. case $arch in
  744. armeb|or1k|sheb)
  745. echo "runtime tests disabled for $arch."
  746. ;;
  747. *)
  748. build $lib $arch $test
  749. runtest $lib $arch $test
  750. ;;
  751. esac
  752. ;;
  753. glibc)
  754. case $arch in
  755. armeb|m68k|nios2|sheb|tile)
  756. echo "runtime tests disabled for $arch."
  757. ;;
  758. *)
  759. build $lib $arch $test
  760. runtest $lib $arch $test
  761. ;;
  762. esac
  763. ;;
  764. esac
  765. else
  766. echo "Test $test is not valid. Allowed tests: $valid_tests"
  767. exit 1
  768. fi
  769. done
  770. fi
  771. done
  772. done
  773. echo "All tests finished."
  774. exit 0