embedded-test.sh 16 KB

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