embedded-test.sh 16 KB

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