embedded-test.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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. # uClibc-ng
  28. arch_list_uclibcng_quick="arm arc avr32 bfin c6x cris m68k m68k-nommu mipsel mips64el ppcsf sh sparc x86 x86_64 xtensa"
  29. arch_list_uclibcng="arm armhf armeb arc arcbe avr32 bfin c6x cris m68k m68k-nommu mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc ppcsf sh sheb sparc x86 x86_64 xtensa"
  30. # musl
  31. arch_list_musl_quick="aarch64 arm microblazeel mipsel ppcsf sh x86 x86_64"
  32. arch_list_musl="aarch64 arm armhf armeb microblazeel microblazebe mips mipssf mipsel mipselsf ppc ppcsf sh sheb x86 x86_64"
  33. # glibc
  34. arch_list_glibc_quick="aarch64 arm m68k microblazeel mipsel mips64eln64 nios2 ppcsf ppc64 sh sparc sparc64 tile x86 x86_64"
  35. arch_list_glibc="aarch64 arm armhf armeb m68k microblazeel microblazebe mips mipssf mipsel mipselsf mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 nios2 ppc ppcsf ppc64 sh sheb sparc sparc64 tile x86 x86_64"
  36. topdir=$(pwd)
  37. openadk_git=http://git.openadk.org/openadk.git
  38. tools='make git wget xz cpio tar awk sed'
  39. f=0
  40. for tool in $tools; do
  41. if ! which $tool >/dev/null; then
  42. echo "Checking if $tool is installed... failed"
  43. f=1
  44. fi
  45. done
  46. if [ $f -eq 1 ];then exit 1; fi
  47. help() {
  48. cat >&2 <<EOF
  49. Syntax: $0 [ -l <libc> -a <arch> -t <tests> ]
  50. Explanation:
  51. -l: c library to use (uclibc-ng|musl|glibc)
  52. -g: use latest git version of C library
  53. -a: architecture to check (otherwise all supported)
  54. -u: update openadk source via git pull, before building
  55. -s: use directory with source for C library
  56. -f: enable fast compile, after a failure no rebuild
  57. -d: enable debug output from OpenADK
  58. -c: clean OpenADK build directory before build
  59. -m: start a shell in Qemu system for manual testing
  60. -n: set NTP server for test run
  61. -p: add extra packages to build
  62. -q: use quick mode (no endian|abi|float combinations)
  63. -t: run tests (boot|libc|ltp|native)
  64. -h: help text
  65. EOF
  66. }
  67. clean=0
  68. shell=0
  69. update=0
  70. debug=0
  71. git=0
  72. fast=0
  73. quick=0
  74. ntp=time.fu-berlin.de
  75. while getopts "hfgumdqcn:a:s:l:t:p:" ch; do
  76. case $ch in
  77. m)
  78. shell=1
  79. ;;
  80. g)
  81. git=1
  82. ;;
  83. c)
  84. clean=1
  85. ;;
  86. d)
  87. debug=1
  88. ;;
  89. f)
  90. fast=1
  91. ;;
  92. q)
  93. quick=1
  94. ;;
  95. u)
  96. update=1
  97. ;;
  98. s)
  99. source=$OPTARG
  100. ;;
  101. l)
  102. libc=$OPTARG
  103. ;;
  104. n)
  105. ntp=$OPTARG
  106. ;;
  107. a)
  108. archtolist=$OPTARG
  109. ;;
  110. p)
  111. pkgs=$OPTARG
  112. ;;
  113. t)
  114. tests=$OPTARG
  115. ;;
  116. h)
  117. help
  118. exit 1
  119. ;;
  120. esac
  121. done
  122. shift $((OPTIND - 1))
  123. if [ -z "$libc" ];then
  124. libc="uclibc-ng musl glibc"
  125. fi
  126. if [ ! -d openadk ];then
  127. git clone $openadk_git
  128. if [ $? -ne 0 ];then
  129. echo "Cloning from $openadk_git failed."
  130. exit 1
  131. fi
  132. else
  133. if [ $update -eq 1 ];then
  134. (cd openadk && git pull)
  135. if [ $? -ne 0 ];then
  136. echo "Updating from $openadk_git failed."
  137. exit 1
  138. fi
  139. fi
  140. fi
  141. runtest() {
  142. lib=$1
  143. arch=$2
  144. test=$3
  145. qemu=qemu-system-${arch}
  146. qemu_args=
  147. qemu_append="ntp_server=$ntp"
  148. if [ $debug -eq 0 ];then
  149. qemu_append="$qemu_append quiet"
  150. fi
  151. if [ $shell -eq 1 ];then
  152. qemu_append="$qemu_append shell"
  153. fi
  154. suffix=
  155. psuffix=
  156. libdir=lib
  157. march=${arch}
  158. case ${arch} in
  159. aarch64)
  160. cpu_arch=aarch64
  161. qemu_machine=virt
  162. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  163. ;;
  164. arm)
  165. cpu_arch=arm
  166. qemu_machine=vexpress-a9
  167. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  168. suffix=eabi
  169. psuffix=$suffix
  170. ;;
  171. armhf)
  172. cpu_arch=arm
  173. march=arm
  174. qemu=qemu-system-${cpu_arch}
  175. qemu_machine=vexpress-a9
  176. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  177. suffix=eabihf
  178. psuffix=$suffix
  179. ;;
  180. microblazeel)
  181. cpu_arch=microblazeel
  182. march=microblaze
  183. qemu_machine=petalogix-s3adsp1800
  184. ;;
  185. microblazebe)
  186. cpu_arch=microblazebe
  187. march=microblaze
  188. qemu=qemu-system-${march}
  189. qemu_machine=petalogix-s3adsp1800
  190. ;;
  191. mips)
  192. cpu_arch=mips
  193. qemu_machine=malta
  194. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  195. ;;
  196. mipsel)
  197. cpu_arch=mipsel
  198. march=mips
  199. qemu_machine=malta
  200. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  201. ;;
  202. mips64)
  203. cpu_arch=mips64
  204. qemu_machine=malta
  205. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  206. suffix=abi32
  207. psuffix=o32
  208. ;;
  209. mips64n32)
  210. cpu_arch=mips64
  211. march=mips64
  212. qemu=qemu-system-${cpu_arch}
  213. qemu_machine=malta
  214. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  215. suffix=abin32
  216. psuffix=n32
  217. ;;
  218. mips64n64)
  219. cpu_arch=mips64
  220. march=mips64
  221. qemu=qemu-system-${cpu_arch}
  222. qemu_machine=malta
  223. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  224. suffix=abi64
  225. psuffix=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=abi32
  233. psuffix=o32
  234. ;;
  235. mips64eln32)
  236. cpu_arch=mips64el
  237. march=mips64
  238. qemu=qemu-system-${cpu_arch}
  239. qemu_machine=malta
  240. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  241. suffix=abin32
  242. psuffix=n32
  243. ;;
  244. mips64eln64)
  245. cpu_arch=mips64el
  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=abi64
  251. psuffix=n64
  252. ;;
  253. ppcsf)
  254. cpu_arch=ppc
  255. march=ppc
  256. qemu=qemu-system-${cpu_arch}
  257. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  258. qemu_machine=bamboo
  259. ;;
  260. ppc)
  261. cpu_arch=ppc
  262. march=ppc
  263. qemu=qemu-system-${cpu_arch}
  264. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  265. qemu_machine=mac99
  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} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  293. ;;
  294. x86)
  295. cpu_arch=i486
  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. suffix=x32
  311. ;;
  312. xtensa)
  313. cpu_arch=xtensa
  314. qemu=qemu-system-${cpu_arch}
  315. qemu_machine=lx60
  316. qemu_args="${qemu_args} -cpu dc233c"
  317. ;;
  318. *)
  319. echo "architecture ${arch} not supported"; exit 1;;
  320. esac
  321. if ! which $qemu >/dev/null; then
  322. echo "Checking if $qemu is installed... failed"
  323. exit 1
  324. fi
  325. qemuver=$(${qemu} -version|awk '{ print $4 }')
  326. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  327. echo "Your qemu version is too old. Please update to 2.1 or greater"
  328. exit 1
  329. fi
  330. echo "Starting test for $lib and ${arch}"
  331. echo "Generating root filesystem for test run"
  332. root=$(mktemp -d /tmp/XXXX)
  333. if [ ! -f openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.xz ];then
  334. echo "No root filesystem available for architecture ${arch}"
  335. exit 1
  336. fi
  337. tar -xf openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.xz -C $root
  338. if [ $test = "boot" ];then
  339. cat > ${root}/run.sh << EOF
  340. #!/bin/sh
  341. uname -a
  342. rdate -n \$ntp_server
  343. file /bin/busybox
  344. for i in \$(ls /lib/*.so|grep -v libgcc);do
  345. size \$i
  346. done
  347. exit
  348. EOF
  349. fi
  350. if [ $test = "ltp" ];then
  351. cat > ${root}/run.sh << EOF
  352. #!/bin/sh
  353. uname -a
  354. rdate -n \$ntp_server
  355. /opt/ltp/runltp
  356. exit
  357. EOF
  358. fi
  359. if [ $test = "libc" ];then
  360. case $lib in
  361. uclibc-ng)
  362. cat > ${root}/run.sh << EOF
  363. #!/bin/sh
  364. uname -a
  365. rdate -n \$ntp_server
  366. cd /opt/*/test
  367. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  368. exit
  369. EOF
  370. ;;
  371. musl|glibc)
  372. cat > ${root}/run.sh << EOF
  373. #!/bin/sh
  374. uname -a
  375. rdate -n \$ntp_server
  376. cd /opt/libc-test
  377. make run
  378. exit
  379. EOF
  380. ;;
  381. esac
  382. fi
  383. chmod u+x ${root}/run.sh
  384. kernel=openadk/firmware/qemu-${march}_${lib}/qemu-${march}-initramfsarchive-kernel
  385. echo "Creating initramfs filesystem"
  386. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  387. rm -rf $root
  388. echo "Now running the test ${test} in qemu for architecture ${arch} and ${lib}"
  389. 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}"
  390. ${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}.${lib}.${test}.${version}
  391. if [ $? -eq 0 ];then
  392. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  393. echo
  394. else
  395. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  396. echo
  397. fi
  398. }
  399. compile() {
  400. rm .config* .defconfig 2>/dev/null
  401. make $1 defconfig
  402. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  403. make $1 all
  404. }
  405. build() {
  406. lib=$1
  407. arch=$2
  408. test=$3
  409. cd openadk
  410. make prereq
  411. # always trigger regeneration of kernel config
  412. rm build_*_${lib}_${arch}*/linux/.config > /dev/null 2>&1
  413. # download and rebuild C library package
  414. if [ $fast -eq 0 ];then
  415. make package=$lib clean > /dev/null 2>&1
  416. fi
  417. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive"
  418. if [ $debug -eq 1 ];then
  419. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  420. fi
  421. if [ $git -eq 1 ];then
  422. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  423. fi
  424. if [ $test = "boot" ];then
  425. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  426. fi
  427. if [ $test = "ltp" ];then
  428. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  429. fi
  430. if [ $test = "libc" ];then
  431. case $lib in
  432. uclibc-ng)
  433. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  434. ;;
  435. glibc)
  436. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  437. ;;
  438. musl)
  439. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  440. ;;
  441. esac
  442. fi
  443. if [ $test = "native" ];then
  444. case $lib in
  445. uclibc-ng)
  446. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  447. ;;
  448. musl)
  449. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  450. ;;
  451. glibc)
  452. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  453. ;;
  454. esac
  455. fi
  456. case $arch in
  457. aarch64)
  458. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  459. compile "$DEFAULT"
  460. ;;
  461. arc)
  462. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  463. compile "$DEFAULT"
  464. ;;
  465. arcbe)
  466. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  467. compile "$DEFAULT"
  468. ;;
  469. arm)
  470. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=little"
  471. compile "$DEFAULT"
  472. ;;
  473. armeb)
  474. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  475. compile "$DEFAULT"
  476. ;;
  477. armhf)
  478. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=little"
  479. compile "$DEFAULT"
  480. ;;
  481. avr32)
  482. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  483. compile "$DEFAULT"
  484. ;;
  485. bfin)
  486. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  487. compile "$DEFAULT"
  488. ;;
  489. c6x)
  490. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=toolchain-c6x"
  491. compile "$DEFAULT"
  492. ;;
  493. cris)
  494. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris"
  495. compile "$DEFAULT"
  496. ;;
  497. m68k)
  498. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  499. compile "$DEFAULT"
  500. ;;
  501. m68k-nommu)
  502. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  503. compile "$DEFAULT"
  504. ;;
  505. microblazebe)
  506. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=big"
  507. compile "$DEFAULT"
  508. ;;
  509. microblazeel)
  510. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=little"
  511. compile "$DEFAULT"
  512. ;;
  513. mips)
  514. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard"
  515. compile "$DEFAULT"
  516. ;;
  517. mipssf)
  518. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft"
  519. compile "$DEFAULT"
  520. ;;
  521. mipsel)
  522. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard"
  523. compile "$DEFAULT"
  524. ;;
  525. mipselsf)
  526. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft"
  527. compile "$DEFAULT"
  528. ;;
  529. mips64)
  530. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  531. compile "$DEFAULT"
  532. ;;
  533. mips64n32)
  534. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  535. compile "$DEFAULT"
  536. ;;
  537. mips64n64)
  538. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  539. compile "$DEFAULT"
  540. ;;
  541. mips64el)
  542. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  543. compile "$DEFAULT"
  544. ;;
  545. mips64eln32)
  546. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  547. compile "$DEFAULT"
  548. ;;
  549. mips64eln64)
  550. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  551. compile "$DEFAULT"
  552. ;;
  553. nios2)
  554. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=toolchain-nios2"
  555. compile "$DEFAULT"
  556. ;;
  557. ppc)
  558. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_FLOAT=hard"
  559. compile "$DEFAULT"
  560. ;;
  561. ppcsf)
  562. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc ADK_TARGET_FLOAT=soft"
  563. compile "$DEFAULT"
  564. ;;
  565. sh)
  566. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  567. compile "$DEFAULT"
  568. ;;
  569. sheb)
  570. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  571. compile "$DEFAULT"
  572. ;;
  573. tile)
  574. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  575. compile "$DEFAULT"
  576. ;;
  577. *)
  578. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  579. compile "$DEFAULT"
  580. ;;
  581. esac
  582. if [ $? -ne 0 ];then
  583. echo "build failed"
  584. exit 1
  585. fi
  586. cd ..
  587. }
  588. for lib in ${libc}; do
  589. case $lib in
  590. uclibc-ng)
  591. if [ $quick -eq 1 ]; then
  592. archlist=$arch_list_uclibcng_quick
  593. else
  594. archlist=$arch_list_uclibcng
  595. fi
  596. version=1.0.1
  597. gitversion=git
  598. if [ $git -eq 1 ]; then
  599. libver=uClibc-ng-${gitversion}
  600. else
  601. libver=uClibc-ng-${version}
  602. fi
  603. libdir=uClibc-ng
  604. ;;
  605. glibc)
  606. if [ $quick -eq 1 ]; then
  607. archlist=$arch_list_glibc_quick
  608. else
  609. archlist=$arch_list_glibc
  610. fi
  611. version=2.21
  612. gitversion=2.21.90
  613. if [ $git -eq 1 ]; then
  614. libver=glibc-${gitversion}
  615. else
  616. libver=glibc-${version}
  617. fi
  618. libdir=glibc
  619. ;;
  620. musl)
  621. if [ $quick -eq 1 ]; then
  622. archlist=$arch_list_musl_quick
  623. else
  624. archlist=$arch_list_musl
  625. fi
  626. version=1.1.8
  627. gitversion=git
  628. if [ $git -eq 1 ]; then
  629. libver=musl-${gitversion}
  630. else
  631. libver=musl-${version}
  632. fi
  633. libdir=musl
  634. ;;
  635. esac
  636. if [ ! -z $archtolist ];then
  637. archlist="$archtolist"
  638. fi
  639. if [ ! -z $source ];then
  640. if [ ! -d $source ];then
  641. echo "Not a directory."
  642. exit 1
  643. fi
  644. if [ $fast -eq 0 ];then
  645. usrc=$(mktemp -d /tmp/XXXX)
  646. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  647. cp -a $source $usrc/$libver
  648. mkdir -p $topdir/openadk/dl 2>/dev/null
  649. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  650. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  651. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  652. fi
  653. fi
  654. echo "Architectures to test: $archlist"
  655. for arch in ${archlist}; do
  656. # start with a clean dir
  657. if [ $clean -eq 1 ];then
  658. (cd openadk && make cleandir)
  659. fi
  660. echo "Compiling base system and toolchain for $lib and $arch"
  661. build $lib $arch notest
  662. if [ ! -z "$tests" ];then
  663. for test in ${tests}; do
  664. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  665. case $lib in
  666. uclibc-ng)
  667. case $arch in
  668. arc|arcbe|armeb|avr32|bfin|c6x|cris|microblazeel|microblazebe|m68k|m68k-nommu|nios2|sheb|mips64eln32|mips64n32)
  669. echo "runtime tests disabled for $arch."
  670. ;;
  671. *)
  672. build $lib $arch $test
  673. runtest $lib $arch $test
  674. ;;
  675. esac
  676. ;;
  677. musl)
  678. case $arch in
  679. armeb|sheb)
  680. echo "runtime tests disabled for $arch."
  681. ;;
  682. *)
  683. build $lib $arch $test
  684. runtest $lib $arch $test
  685. ;;
  686. esac
  687. ;;
  688. glibc)
  689. case $arch in
  690. armeb|m68k|nios2|sheb|sparc64|tile)
  691. echo "runtime tests disabled for $arch."
  692. ;;
  693. *)
  694. build $lib $arch $test
  695. runtest $lib $arch $test
  696. ;;
  697. esac
  698. ;;
  699. esac
  700. else
  701. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  702. exit 1
  703. fi
  704. done
  705. fi
  706. done
  707. done
  708. echo "All tests finished."
  709. exit 0