embedded-test.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  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. emulator=qemu
  143. qemu=qemu-system-${arch}
  144. qemu_args=
  145. if [ $ntp ]; then
  146. qemu_append="-append ntpserver=$ntp"
  147. fi
  148. if [ $shell -eq 1 ]; then
  149. qemu_append="-append shell"
  150. fi
  151. noappend=0
  152. suffix=
  153. libdir=lib
  154. march=${arch}
  155. case ${arch} in
  156. aarch64)
  157. cpu_arch=aarch64
  158. qemu_machine=virt
  159. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  160. ;;
  161. armv5)
  162. cpu_arch=arm
  163. march=arm-versatilepb
  164. qemu=qemu-system-${cpu_arch}
  165. qemu_machine=versatilepb
  166. suffix=soft_eabi
  167. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  168. qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111"
  169. ;;
  170. armv7)
  171. cpu_arch=arm
  172. march=arm-vexpress-a9
  173. qemu=qemu-system-${cpu_arch}
  174. qemu_machine=vexpress-a9
  175. suffix=hard_eabihf
  176. dtbdir=openadk/firmware/qemu-${march}_${lib}_${cpu_arch}_${suffix}
  177. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
  178. ;;
  179. arcv1)
  180. emulator=nsim
  181. cpu_arch=arc
  182. piggyback=1
  183. ;;
  184. arcv2)
  185. emulator=nsim
  186. cpu_arch=arc
  187. piggyback=1
  188. ;;
  189. crisv32)
  190. cpu_arch=crisv32
  191. march=cris
  192. qemu=qemu-system-${march}
  193. qemu_machine=axis-dev88
  194. piggyback=1
  195. ;;
  196. microblazeel)
  197. cpu_arch=microblazeel
  198. march=microblaze-ml605
  199. qemu_machine=petalogix-s3adsp1800
  200. ;;
  201. microblazebe)
  202. cpu_arch=microblaze
  203. march=microblaze-ml605
  204. qemu=qemu-system-${cpu_arch}
  205. qemu_machine=petalogix-s3adsp1800
  206. ;;
  207. mips)
  208. cpu_arch=mips
  209. qemu=qemu-system-${cpu_arch}
  210. qemu_machine=malta
  211. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  212. suffix=hard
  213. ;;
  214. mipssf)
  215. cpu_arch=mips
  216. march=mips
  217. qemu=qemu-system-${cpu_arch}
  218. qemu_machine=malta
  219. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  220. suffix=soft
  221. ;;
  222. mipsel)
  223. cpu_arch=mipsel
  224. march=mips
  225. qemu=qemu-system-${cpu_arch}
  226. qemu_machine=malta
  227. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  228. suffix=hard
  229. ;;
  230. mipselsf)
  231. cpu_arch=mipsel
  232. march=mips
  233. qemu=qemu-system-${cpu_arch}
  234. qemu_machine=malta
  235. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  236. suffix=soft
  237. ;;
  238. mips64)
  239. cpu_arch=mips64
  240. qemu_machine=malta
  241. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  242. suffix=o32
  243. ;;
  244. mips64n32)
  245. cpu_arch=mips64
  246. march=mips64
  247. qemu=qemu-system-${cpu_arch}
  248. qemu_machine=malta
  249. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  250. suffix=n32
  251. ;;
  252. mips64n64)
  253. cpu_arch=mips64
  254. march=mips64
  255. qemu=qemu-system-${cpu_arch}
  256. qemu_machine=malta
  257. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  258. suffix=n64
  259. ;;
  260. mips64el)
  261. cpu_arch=mips64el
  262. march=mips64
  263. qemu_machine=malta
  264. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  265. suffix=o32
  266. ;;
  267. mips64eln32)
  268. cpu_arch=mips64el
  269. march=mips64
  270. qemu=qemu-system-${cpu_arch}
  271. qemu_machine=malta
  272. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  273. suffix=n32
  274. ;;
  275. mips64eln64)
  276. cpu_arch=mips64el
  277. march=mips64
  278. qemu=qemu-system-${cpu_arch}
  279. qemu_machine=malta
  280. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  281. suffix=n64
  282. ;;
  283. ppcsf)
  284. cpu_arch=ppc
  285. march=ppc-bamboo
  286. qemu=qemu-system-${cpu_arch}
  287. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  288. qemu_machine=bamboo
  289. suffix=soft
  290. ;;
  291. ppc)
  292. cpu_arch=ppc
  293. march=ppc-macppc
  294. qemu=qemu-system-${cpu_arch}
  295. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  296. qemu_machine=mac99
  297. suffix=hard
  298. noappend=1
  299. ;;
  300. powerpc64|ppc64)
  301. cpu_arch=ppc64
  302. qemu=qemu-system-${cpu_arch}
  303. qemu_machine=pseries
  304. ;;
  305. sh)
  306. cpu_arch=sh4
  307. qemu=qemu-system-${cpu_arch}
  308. qemu_machine=r2d
  309. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  310. ;;
  311. sheb)
  312. cpu_arch=sh4eb
  313. march=sh
  314. qemu=qemu-system-${cpu_arch}
  315. qemu_machine=r2d
  316. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  317. ;;
  318. sparc)
  319. cpu_arch=sparc
  320. qemu_machine=SS-5
  321. ;;
  322. sparc64)
  323. cpu_arch=sparc64
  324. qemu_machine=sun4u
  325. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  326. ;;
  327. x86)
  328. cpu_arch=i686
  329. qemu=qemu-system-i386
  330. qemu_machine=pc
  331. qemu_args="${qemu_args}"
  332. ;;
  333. x86_64)
  334. cpu_arch=x86_64
  335. qemu_machine=pc
  336. libdir=lib64
  337. ;;
  338. x86_64_x32)
  339. cpu_arch=x86_64
  340. qemu=qemu-system-${cpu_arch}
  341. qemu_machine=pc
  342. libdir=libx32
  343. ;;
  344. xtensa)
  345. cpu_arch=xtensa
  346. qemu=qemu-system-${cpu_arch}
  347. qemu_machine=lx60
  348. qemu_args="${qemu_args} -cpu dc233c"
  349. ;;
  350. *)
  351. echo "architecture ${arch} not supported"; exit 1;;
  352. esac
  353. case $emulator in
  354. qemu)
  355. echo "Using QEMU as emulator"
  356. if ! which $qemu >/dev/null; then
  357. echo "Checking if $qemu is installed... failed"
  358. exit 1
  359. fi
  360. qemuver=$(${qemu} -version|awk '{ print $4 }')
  361. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  362. echo "Your qemu version is too old. Please update to 2.1 or greater"
  363. exit 1
  364. fi
  365. ;;
  366. nsim)
  367. echo "Using Synopsys NSIM as simulator"
  368. if ! which nsimdrv >/dev/null; then
  369. echo "Checking if $emulator is installed... failed"
  370. exit 1
  371. fi
  372. ;;
  373. *)
  374. echo "emulator/simulator not supported"; exit 1;;
  375. esac
  376. echo "Starting test for $lib and $arch"
  377. # check if initramfs or piggyback is used
  378. if [ $piggyback -eq 1 ]; then
  379. echo "Using extra directory for test image creation"
  380. root=openadk/extra
  381. rm -rf openadk/extra 2>/dev/null
  382. mkdir openadk/extra 2>/dev/null
  383. if [ ! -z $suffix ]; then
  384. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
  385. else
  386. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfspiggyback-kernel
  387. fi
  388. else
  389. echo "Generating root filesystem for test run"
  390. root=$(mktemp -d /tmp/XXXX)
  391. if [ ! -z $suffix ]; then
  392. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
  393. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}_${suffix}/qemu-${march}-initramfsarchive-kernel
  394. else
  395. archive=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
  396. kernel=openadk/firmware/${emulator}-${march}_${lib}_${cpu_arch}/${emulator}-${march}-initramfsarchive-kernel
  397. fi
  398. if [ ! -f $archive ];then
  399. echo "No root filesystem available for architecture ${arch} tried $archive"
  400. exit 1
  401. fi
  402. tar -xf $archive -C $root
  403. fi
  404. # creating test script to be run on boot
  405. cat > ${root}/run.sh << EOF
  406. #!/bin/sh
  407. uname -a
  408. if [ \$ntpserver ]; then
  409. rdate \$ntpserver
  410. else
  411. rdate time.fu-berlin.de
  412. fi
  413. EOF
  414. if [ $test = "boot" ];then
  415. cat >> ${root}/run.sh << EOF
  416. file /bin/busybox
  417. size /bin/busybox
  418. for i in \$(ls /lib/*.so|grep -v libgcc);do
  419. size \$i
  420. done
  421. exit
  422. EOF
  423. fi
  424. if [ $test = "ltp" ];then
  425. cat >> ${root}/run.sh << EOF
  426. /opt/ltp/runltp
  427. exit
  428. EOF
  429. fi
  430. if [ $test = "libc" ];then
  431. case $lib in
  432. uclibc-ng)
  433. cat >> ${root}/run.sh << EOF
  434. cd /opt/uclibc-ng/test
  435. sh ./uclibcng-testrunner.sh
  436. exit
  437. EOF
  438. ;;
  439. musl|glibc)
  440. cat >> ${root}/run.sh << EOF
  441. cd /opt/libc-test
  442. CC=: make run
  443. exit
  444. EOF
  445. ;;
  446. esac
  447. fi
  448. chmod u+x ${root}/run.sh
  449. if [ $piggyback -eq 1 ]; then
  450. (cd openadk && make v)
  451. else
  452. echo "Creating initramfs filesystem"
  453. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  454. rm -rf $root
  455. qemu_args="$qemu_args -initrd initramfs.${arch}"
  456. fi
  457. # qemu-ppc overwrites existing commandline
  458. if [ $noappend -eq 0 ]; then
  459. qemu_args="$qemu_args ${qemu_append}"
  460. fi
  461. echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  462. case $emulator in
  463. qemu)
  464. echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot -nographic"
  465. ${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}
  466. ;;
  467. nsim)
  468. echo "./openadk/scripts/nsim.sh ${arch} ${kernel}"
  469. ./openadk/scripts/nsim.sh ${arch} ${kernel} | tee REPORT.${arch}.${test}.${libver}
  470. ;;
  471. esac
  472. if [ $? -eq 0 ];then
  473. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${test}.${libver}"
  474. echo
  475. else
  476. echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  477. echo
  478. fi
  479. }
  480. compile() {
  481. rm .config* .defconfig 2>/dev/null
  482. make $1 defconfig
  483. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  484. make $1 all
  485. }
  486. build() {
  487. lib=$1
  488. arch=$2
  489. test=$3
  490. cd openadk
  491. make prereq
  492. DEFAULT="ADK_TARGET_LIBC=$lib"
  493. if [ $debug -eq 1 ];then
  494. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  495. fi
  496. if [ $git -eq 1 ];then
  497. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  498. fi
  499. if [ $test = "boot" ];then
  500. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  501. fi
  502. if [ $test = "ltp" ];then
  503. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  504. fi
  505. if [ $test = "libc" ];then
  506. case $lib in
  507. uclibc-ng)
  508. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  509. ;;
  510. glibc)
  511. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  512. ;;
  513. musl)
  514. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  515. ;;
  516. esac
  517. fi
  518. if [ $test = "native" ];then
  519. case $lib in
  520. uclibc-ng)
  521. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  522. ;;
  523. musl)
  524. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  525. ;;
  526. glibc)
  527. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  528. ;;
  529. esac
  530. fi
  531. case $arch in
  532. aarch64)
  533. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
  534. compile "$DEFAULT"
  535. ;;
  536. arcv1)
  537. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=little"
  538. compile "$DEFAULT"
  539. ;;
  540. arcv2)
  541. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=little"
  542. compile "$DEFAULT"
  543. ;;
  544. arcv1-be)
  545. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv1 ADK_TARGET_ENDIAN=big"
  546. compile "$DEFAULT"
  547. ;;
  548. arcv2-be)
  549. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=nsim-arcv2 ADK_TARGET_ENDIAN=big"
  550. compile "$DEFAULT"
  551. ;;
  552. armv5)
  553. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
  554. compile "$DEFAULT"
  555. ;;
  556. armeb)
  557. 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"
  558. compile "$DEFAULT"
  559. ;;
  560. armv7)
  561. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
  562. compile "$DEFAULT"
  563. ;;
  564. avr32)
  565. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-avr32"
  566. compile "$DEFAULT"
  567. ;;
  568. bfin)
  569. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-bfin"
  570. compile "$DEFAULT"
  571. ;;
  572. c6x)
  573. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-c6x"
  574. compile "$DEFAULT"
  575. ;;
  576. crisv10)
  577. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-cris ADK_TARGET_CPU=crisv10"
  578. compile "$DEFAULT"
  579. ;;
  580. crisv32)
  581. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
  582. compile "$DEFAULT"
  583. ;;
  584. h8300)
  585. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=h8300 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-h8300"
  586. compile "$DEFAULT"
  587. ;;
  588. m68k)
  589. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800"
  590. compile "$DEFAULT"
  591. ;;
  592. m68k-nommu)
  593. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208"
  594. compile "$DEFAULT"
  595. ;;
  596. metag)
  597. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-metag"
  598. compile "$DEFAULT"
  599. ;;
  600. microblazebe)
  601. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=big"
  602. compile "$DEFAULT"
  603. ;;
  604. microblazeel)
  605. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-ml605 ADK_TARGET_ENDIAN=little"
  606. compile "$DEFAULT"
  607. ;;
  608. mips)
  609. 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"
  610. compile "$DEFAULT"
  611. ;;
  612. mipssf)
  613. 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"
  614. compile "$DEFAULT"
  615. ;;
  616. mipsel)
  617. 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"
  618. compile "$DEFAULT"
  619. ;;
  620. mipselsf)
  621. 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"
  622. compile "$DEFAULT"
  623. ;;
  624. mips64)
  625. 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"
  626. compile "$DEFAULT"
  627. ;;
  628. mips64n32)
  629. 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"
  630. compile "$DEFAULT"
  631. ;;
  632. mips64n64)
  633. 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"
  634. compile "$DEFAULT"
  635. ;;
  636. mips64el)
  637. 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"
  638. compile "$DEFAULT"
  639. ;;
  640. mips64eln32)
  641. 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"
  642. compile "$DEFAULT"
  643. ;;
  644. mips64eln64)
  645. 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"
  646. compile "$DEFAULT"
  647. ;;
  648. nios2)
  649. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-nios2"
  650. compile "$DEFAULT"
  651. ;;
  652. or1k)
  653. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-or1k"
  654. compile "$DEFAULT"
  655. ;;
  656. ppc)
  657. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard"
  658. compile "$DEFAULT"
  659. ;;
  660. ppcsf)
  661. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft"
  662. compile "$DEFAULT"
  663. ;;
  664. ppc64)
  665. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
  666. compile "$DEFAULT"
  667. ;;
  668. sh)
  669. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  670. compile "$DEFAULT"
  671. ;;
  672. sheb)
  673. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  674. compile "$DEFAULT"
  675. ;;
  676. tile)
  677. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=toolchain-tile"
  678. compile "$DEFAULT"
  679. ;;
  680. *)
  681. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-$arch"
  682. compile "$DEFAULT"
  683. ;;
  684. esac
  685. if [ $? -ne 0 ];then
  686. echo "build failed"
  687. exit 1
  688. fi
  689. cd ..
  690. }
  691. for lib in ${libc}; do
  692. case $lib in
  693. uclibc-ng)
  694. archlist=$arch_list_uclibcng
  695. version=1.0.8
  696. gitversion=git
  697. if [ $git -eq 1 ]; then
  698. libver=uClibc-ng-${gitversion}
  699. else
  700. libver=uClibc-ng-${version}
  701. fi
  702. libdir=uClibc-ng
  703. ;;
  704. glibc)
  705. archlist=$arch_list_glibc
  706. version=2.22
  707. gitversion=2.22.90
  708. if [ $git -eq 1 ]; then
  709. libver=glibc-${gitversion}
  710. else
  711. libver=glibc-${version}
  712. fi
  713. libdir=glibc
  714. ;;
  715. musl)
  716. archlist=$arch_list_musl
  717. version=1.1.11
  718. gitversion=git
  719. if [ $git -eq 1 ]; then
  720. libver=musl-${gitversion}
  721. else
  722. libver=musl-${version}
  723. fi
  724. libdir=musl
  725. ;;
  726. esac
  727. if [ ! -z $archtolist ]; then
  728. archlist="$archtolist"
  729. fi
  730. if [ ! -z $source ]; then
  731. if [ ! -d $source ]; then
  732. echo "Not a directory."
  733. exit 1
  734. fi
  735. if [ $fast -eq 0 ]; then
  736. usrc=$(mktemp -d /tmp/XXXX)
  737. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  738. cp -a $source $usrc/$libver
  739. mkdir -p $topdir/openadk/dl 2>/dev/null
  740. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  741. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  742. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  743. fi
  744. fi
  745. # start with a clean dir
  746. if [ $clean -eq 1 ]; then
  747. (cd openadk && make cleandir)
  748. fi
  749. echo "Architectures to test: $archlist"
  750. for arch in ${archlist}; do
  751. if [ $break -eq 1 -a -f "REPORT.${arch}.${tests}.${libver}" ]; then
  752. echo "Skipping this test after last build break"
  753. continue
  754. fi
  755. echo "Compiling base system and toolchain for $lib and $arch"
  756. build $lib $arch notest
  757. if [ ! -z "$tests" ];then
  758. for test in ${tests}; do
  759. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  760. case $lib in
  761. uclibc-ng)
  762. case $arch in
  763. arcv1-be|arcv2-be|armeb|avr32|bfin|c6x|crisv10|h8300|lm32|microblazeel|microblazebe|m68k|m68k-nommu|nios2|or1k|sheb)
  764. echo "runtime tests disabled for $arch."
  765. ;;
  766. *)
  767. build $lib $arch $test
  768. runtest $lib $arch $test
  769. ;;
  770. esac
  771. ;;
  772. musl)
  773. case $arch in
  774. armeb|or1k|sheb)
  775. echo "runtime tests disabled for $arch."
  776. ;;
  777. *)
  778. build $lib $arch $test
  779. runtest $lib $arch $test
  780. ;;
  781. esac
  782. ;;
  783. glibc)
  784. case $arch in
  785. armeb|m68k|nios2|sheb|sparc64|tile)
  786. echo "runtime tests disabled for $arch."
  787. ;;
  788. *)
  789. build $lib $arch $test
  790. runtest $lib $arch $test
  791. ;;
  792. esac
  793. ;;
  794. esac
  795. else
  796. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  797. exit 1
  798. fi
  799. done
  800. fi
  801. done
  802. done
  803. echo "All tests finished."
  804. exit 0