embedded-test.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. #!/bin/sh
  2. # Copyright © 2014
  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. # mips64n32/mips64eln32 produces segfaults on boot for uClibc/uClibc-ng
  25. # sheb network card get no ip
  26. # testsuite compile issues for m68k
  27. arch_list_uclibcng="arm armhf bfin m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64 xtensa"
  28. arch_list_uclibc="arm armhf arc arcbe avr32 bfin m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64 xtensa"
  29. arch_list_musl="arm armhf mips mipsel ppc-nofpu sh sheb x86 x86_64"
  30. arch_list_glibc="aarch64 arm armhf m68k mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 ppc-nofpu ppc64 sh sheb sparc sparc64 x86 x86_64"
  31. topdir=$(pwd)
  32. openadk_git=http://git.openadk.org/openadk.git
  33. tools='make git wget xz cpio tar awk sed'
  34. f=0
  35. for tool in $tools; do
  36. if ! which $tool >/dev/null; then
  37. echo "Checking if $tool is installed... failed"
  38. f=1
  39. fi
  40. done
  41. if [ $f -eq 1 ];then exit 1; fi
  42. help() {
  43. cat >&2 <<EOF
  44. Syntax: $0 [ -l <libc> -a <arch> -t <tests> ]
  45. Explanation:
  46. -l: c library to use (uclibc-ng|musl|glibc|uclibc)
  47. -g: use latest git version of C library
  48. -a: architecture to check (otherwise all supported)
  49. -u: update openadk source via git pull, before building
  50. -s: use directory with source for C library
  51. -d: enable debug output from OpenADK
  52. -c: clean OpenADK build directory before build
  53. -n: set NTP server for test run
  54. -t: run tests (boot|libc|ltp|native)
  55. -p: add extra packages to build
  56. -r: rebuild C library
  57. -m: start a shell in Qemu system for manual testing
  58. -h: help text
  59. EOF
  60. }
  61. clean=0
  62. shell=0
  63. update=0
  64. debug=0
  65. git=0
  66. rebuild=0
  67. ntp=time.fu-berlin.de
  68. while getopts "hgrumdcn:a:s:l:t:p:" ch; do
  69. case $ch in
  70. m)
  71. shell=1
  72. ;;
  73. g)
  74. git=1
  75. ;;
  76. c)
  77. clean=1
  78. ;;
  79. d)
  80. debug=1
  81. ;;
  82. u)
  83. update=1
  84. ;;
  85. r)
  86. rebuild=1
  87. ;;
  88. s)
  89. source=$OPTARG
  90. ;;
  91. l)
  92. libc=$OPTARG
  93. ;;
  94. n)
  95. ntp=$OPTARG
  96. ;;
  97. a)
  98. archlist=$OPTARG
  99. ;;
  100. p)
  101. pkgs=$OPTARG
  102. ;;
  103. t)
  104. tests=$OPTARG
  105. ;;
  106. h)
  107. help
  108. exit 1
  109. ;;
  110. esac
  111. done
  112. shift $((OPTIND - 1))
  113. if [ -z "$libc" ];then
  114. libc="uclibc-ng uclibc musl glibc"
  115. fi
  116. if [ ! -d openadk ];then
  117. git clone $openadk_git
  118. if [ $? -ne 0 ];then
  119. echo "Cloning from $openadk_git failed."
  120. exit 1
  121. fi
  122. else
  123. if [ $update -eq 1 ];then
  124. (cd openadk && git pull)
  125. if [ $? -ne 0 ];then
  126. echo "Updating from $openadk_git failed."
  127. exit 1
  128. fi
  129. fi
  130. fi
  131. runtest() {
  132. lib=$1
  133. arch=$2
  134. test=$3
  135. qemu=qemu-system-${arch}
  136. qemu_args=
  137. qemu_append="ntp_server=$ntp"
  138. if [ $debug -eq 0 ];then
  139. qemu_append="$qemu_append quiet"
  140. fi
  141. if [ $shell -eq 1 ];then
  142. qemu_append="$qemu_append shell"
  143. fi
  144. suffix=
  145. psuffix=
  146. libdir=lib
  147. march=${arch}
  148. case ${arch} in
  149. aarch64)
  150. cpu_arch=aarch64
  151. qemu_machine=virt
  152. qemu_args="${qemu_args} -cpu cortex-a57 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
  153. ;;
  154. arm)
  155. cpu_arch=arm
  156. qemu_machine=vexpress-a9
  157. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  158. suffix=eabi
  159. psuffix=$suffix
  160. ;;
  161. armhf)
  162. cpu_arch=arm
  163. march=arm
  164. qemu=qemu-system-${cpu_arch}
  165. qemu_machine=vexpress-a9
  166. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  167. suffix=eabihf
  168. psuffix=$suffix
  169. ;;
  170. mips)
  171. cpu_arch=mips
  172. qemu_machine=malta
  173. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  174. ;;
  175. mipsel)
  176. cpu_arch=mipsel
  177. march=mips
  178. qemu_machine=malta
  179. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  180. ;;
  181. mips64)
  182. cpu_arch=mips64
  183. qemu_machine=malta
  184. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  185. suffix=abi32
  186. psuffix=o32
  187. ;;
  188. mips64n32)
  189. cpu_arch=mips64
  190. march=mips64
  191. qemu=qemu-system-${cpu_arch}
  192. qemu_machine=malta
  193. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  194. suffix=abin32
  195. psuffix=n32
  196. ;;
  197. mips64n64)
  198. cpu_arch=mips64
  199. march=mips64
  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=abi64
  204. psuffix=n64
  205. ;;
  206. mips64el)
  207. cpu_arch=mips64el
  208. march=mips64
  209. qemu_machine=malta
  210. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  211. suffix=abi32
  212. psuffix=o32
  213. ;;
  214. mips64eln32)
  215. cpu_arch=mips64el
  216. march=mips64
  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=abin32
  221. psuffix=n32
  222. ;;
  223. mips64eln64)
  224. cpu_arch=mips64el
  225. march=mips64
  226. qemu=qemu-system-${cpu_arch}
  227. qemu_machine=malta
  228. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  229. suffix=abi64
  230. psuffix=n64
  231. ;;
  232. ppc-nofpu)
  233. cpu_arch=ppc
  234. march=ppc
  235. qemu=qemu-system-${cpu_arch}
  236. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  237. qemu_machine=bamboo
  238. ;;
  239. ppc)
  240. cpu_arch=ppc
  241. march=ppc
  242. qemu=qemu-system-${cpu_arch}
  243. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  244. qemu_machine=mac99
  245. ;;
  246. powerpc64|ppc64)
  247. cpu_arch=ppc64
  248. qemu=qemu-system-${cpu_arch}
  249. qemu_machine=pseries
  250. ;;
  251. sh)
  252. cpu_arch=sh4
  253. qemu=qemu-system-${cpu_arch}
  254. qemu_machine=r2d
  255. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  256. ;;
  257. sheb)
  258. cpu_arch=sh4eb
  259. march=sh
  260. qemu=qemu-system-${cpu_arch}
  261. qemu_machine=r2d
  262. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  263. ;;
  264. sparc)
  265. cpu_arch=sparc
  266. qemu_machine=SS-5
  267. ;;
  268. sparc64)
  269. cpu_arch=sparc64
  270. qemu_machine=sun4u
  271. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  272. ;;
  273. x86)
  274. cpu_arch=i486
  275. qemu=qemu-system-i386
  276. qemu_machine=pc
  277. qemu_args="${qemu_args}"
  278. ;;
  279. x86_64)
  280. cpu_arch=x86_64
  281. qemu_machine=pc
  282. libdir=lib64
  283. ;;
  284. x86_64_x32)
  285. cpu_arch=x86_64
  286. qemu=qemu-system-${cpu_arch}
  287. qemu_machine=pc
  288. libdir=libx32
  289. suffix=x32
  290. ;;
  291. xtensa)
  292. cpu_arch=xtensa
  293. qemu=qemu-system-${cpu_arch}
  294. qemu_machine=lx60
  295. qemu_args="${qemu_args} -cpu dc232b"
  296. ;;
  297. *)
  298. echo "architecture ${arch} not supported"; exit 1;;
  299. esac
  300. if ! which $qemu >/dev/null; then
  301. echo "Checking if $qemu is installed... failed"
  302. exit 1
  303. fi
  304. qemuver=$(${qemu} -version|awk '{ print $4 }')
  305. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  306. echo "Your qemu version is too old. Please update to 2.1 or greater"
  307. exit 1
  308. fi
  309. case $lib in
  310. uclibc-ng)
  311. prefix=uclibc
  312. ;;
  313. glibc)
  314. prefix=gnu
  315. ;;
  316. *)
  317. prefix=$libc
  318. ;;
  319. esac
  320. cross=${cpu_arch}-openadk-linux-${prefix}${suffix}
  321. if [ -z $psuffix ];then
  322. TCPATH=${topdir}/openadk/toolchain_qemu-${march}_${lib}_${cpu_arch}
  323. else
  324. TCPATH=${topdir}/openadk/toolchain_qemu-${march}_${lib}_${cpu_arch}_${psuffix}
  325. fi
  326. export PATH="${TCPATH}/usr/bin:$PATH"
  327. if ! which ${cross}-gcc >/dev/null; then
  328. echo "Checking if ${cross}-gcc is installed... failed"
  329. exit 1
  330. fi
  331. echo "Starting test for $lib and ${arch}"
  332. echo "Generating root filesystem for test run"
  333. root=$(mktemp -d /tmp/XXXX)
  334. if [ ! -f openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz ];then
  335. echo "No root filesystem available for architecture ${arch}"
  336. exit 1
  337. fi
  338. tar -xf openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.gz -C $root
  339. if [ $test = "boot" ];then
  340. cat > ${root}/run.sh << EOF
  341. #!/bin/sh
  342. uname -a
  343. rdate -n \$ntp_server
  344. file /bin/busybox
  345. for i in \$(ls /lib/*.so|grep -v libgcc);do
  346. size \$i
  347. done
  348. exit
  349. EOF
  350. fi
  351. if [ $test = "ltp" ];then
  352. cat > ${root}/run.sh << EOF
  353. #!/bin/sh
  354. uname -a
  355. rdate -n \$ntp_server
  356. /opt/ltp/runltp
  357. exit
  358. EOF
  359. fi
  360. if [ $test = "libc" ];then
  361. case $lib in
  362. uclibc-ng|uclibc)
  363. cat > ${root}/run.sh << EOF
  364. #!/bin/sh
  365. uname -a
  366. rdate -n \$ntp_server
  367. cd /opt/$libc/test
  368. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  369. exit
  370. EOF
  371. ;;
  372. musl|glibc)
  373. cat > ${root}/run.sh << EOF
  374. #!/bin/sh
  375. uname -a
  376. rdate -n \$ntp_server
  377. cd /opt/libc-test
  378. make run
  379. exit
  380. EOF
  381. ;;
  382. esac
  383. fi
  384. chmod u+x ${root}/run.sh
  385. kernel=openadk/firmware/qemu-${march}_${lib}/qemu-${march}-initramfsarchive-kernel
  386. echo "Creating initramfs filesystem"
  387. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  388. rm -rf $root
  389. echo "Now running the tests in qemu for architecture ${arch} and ${lib}"
  390. 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}"
  391. ${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}
  392. if [ $? -eq 0 ];then
  393. echo "Test for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  394. echo
  395. else
  396. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  397. echo
  398. fi
  399. }
  400. compile() {
  401. rm .config* .defconfig 2>/dev/null
  402. make $1 defconfig
  403. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  404. make $1 all
  405. }
  406. build() {
  407. lib=$1
  408. arch=$2
  409. test=$3
  410. cd openadk
  411. make prereq
  412. # always trigger regeneration of kernel config
  413. rm build_*_${lib}_${arch}*/linux/.config 2>/dev/null
  414. if [ $rebuild -eq 1 ];then
  415. rm dl/$lib*
  416. make package=$lib clean
  417. fi
  418. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive ADK_TARGET_COLLECTION=test"
  419. if [ $debug -eq 1 ];then
  420. DEFAULT="$DEFAULT VERBOSE=1"
  421. fi
  422. if [ $git -eq 1 ];then
  423. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  424. fi
  425. if [ ! -z $source ];then
  426. DEFAULT="$DEFAULT ADK_NO_CHECKSUM=y"
  427. fi
  428. if [ $test = "boot" ];then
  429. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  430. fi
  431. if [ $test = "ltp" ];then
  432. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  433. fi
  434. if [ $test = "libc" ];then
  435. case $lib in
  436. uclibc-ng)
  437. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  438. ;;
  439. uclibc)
  440. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  441. ;;
  442. glibc)
  443. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  444. ;;
  445. musl)
  446. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  447. ;;
  448. esac
  449. fi
  450. if [ $test = "native" ];then
  451. case $lib in
  452. uclibc-ng)
  453. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  454. ;;
  455. uclibc)
  456. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  457. ;;
  458. musl)
  459. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  460. ;;
  461. glibc)
  462. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  463. ;;
  464. esac
  465. fi
  466. case $arch in
  467. aarch64)
  468. DEFAULT="$DEFAULT ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  469. compile "$DEFAULT"
  470. ;;
  471. arc)
  472. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  473. compile "$DEFAULT"
  474. ;;
  475. arcbe)
  476. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  477. compile "$DEFAULT"
  478. ;;
  479. arm)
  480. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabi ADK_TARGET_ENDIAN=little"
  481. compile "$DEFAULT"
  482. ;;
  483. armhf)
  484. DEFAULT="$DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabihf ADK_TARGET_ENDIAN=little"
  485. compile "$DEFAULT"
  486. ;;
  487. bfin)
  488. DEFAULT="$DEFAULT ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  489. compile "$DEFAULT"
  490. ;;
  491. m68k)
  492. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  493. compile "$DEFAULT"
  494. ;;
  495. m68k-nommu)
  496. DEFAULT="$DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  497. compile "$DEFAULT"
  498. ;;
  499. mips)
  500. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big"
  501. compile "$DEFAULT"
  502. ;;
  503. mipsel)
  504. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little"
  505. compile "$DEFAULT"
  506. ;;
  507. mips64)
  508. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  509. compile "$DEFAULT"
  510. ;;
  511. mips64n32)
  512. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  513. compile "$DEFAULT"
  514. ;;
  515. mips64n64)
  516. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  517. compile "$DEFAULT"
  518. ;;
  519. mips64el)
  520. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  521. compile "$DEFAULT"
  522. ;;
  523. mips64eln32)
  524. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  525. compile "$DEFAULT"
  526. ;;
  527. mips64eln64)
  528. DEFAULT="$DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  529. compile "$DEFAULT"
  530. ;;
  531. ppc-nofpu)
  532. DEFAULT="$DEFAULT ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc"
  533. compile "$DEFAULT"
  534. ;;
  535. sh)
  536. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  537. compile "$DEFAULT"
  538. ;;
  539. sheb)
  540. DEFAULT="$DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  541. compile "$DEFAULT"
  542. ;;
  543. *)
  544. DEFAULT="$DEFAULT ADK_TARGET_ARCH=$1 ADK_TARGET_SYSTEM=qemu-$1"
  545. compile "$DEFAULT"
  546. ;;
  547. esac
  548. if [ $? -ne 0 ];then
  549. echo "build failed"
  550. exit 1
  551. fi
  552. cd ..
  553. }
  554. for lib in ${libc}; do
  555. case $lib in
  556. uclibc-ng)
  557. if [ -z "$archlist" ];then
  558. archlist=$arch_list_uclibcng
  559. fi
  560. version=1.0.0
  561. gitversion=1.0.0-git
  562. libver=uClibc-ng-${gitversion}
  563. libdir=uClibc-ng
  564. ;;
  565. uclibc)
  566. if [ -z "$archlist" ];then
  567. archlist=$arch_list_uclibc
  568. fi
  569. version=0.9.33.2
  570. gitversion=0.9.34-git
  571. libver=uClibc-${gitversion}
  572. libdir=uClibc
  573. ;;
  574. glibc)
  575. if [ -z "$archlist" ];then
  576. archlist=$arch_list_glibc
  577. fi
  578. version=2.20
  579. gitversion=2.19.90
  580. libver=glibc-${gitversion}
  581. libdir=glibc
  582. ;;
  583. musl)
  584. if [ -z "$archlist" ];then
  585. archlist=$arch_list_musl
  586. fi
  587. version=1.1.4
  588. gitversion=git
  589. libver=musl-${gitversion}
  590. libdir=musl
  591. ;;
  592. esac
  593. if [ ! -z $source ];then
  594. if [ ! -d $source ];then
  595. echo "Not a directory."
  596. exit 1
  597. fi
  598. git=1
  599. usrc=$(mktemp -d /tmp/XXXX)
  600. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  601. cp -a $source $usrc/$libver
  602. mkdir -p $topdir/openadk/dl 2>/dev/null
  603. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  604. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  605. fi
  606. for arch in ${archlist}; do
  607. # start with a clean dir
  608. if [ $clean -eq 1 ];then
  609. (cd openadk && make cleandir)
  610. fi
  611. echo "Compiling base system and toolchain for $lib and $arch"
  612. build $lib $arch notest
  613. if [ ! -z "$tests" ];then
  614. for test in ${tests}; do
  615. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  616. case $arch in
  617. arc|arcbe|avr32|bfin|m68k|m68k-nommu|ppc|sheb|mips64eln32|mips64n32)
  618. echo "runtime tests disabled for $arch."
  619. ;;
  620. *)
  621. build $lib $arch $test
  622. runtest $lib $arch $test
  623. ;;
  624. esac
  625. else
  626. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  627. exit 1
  628. fi
  629. done
  630. fi
  631. done
  632. done
  633. echo "All tests finished."
  634. exit 0