embedded-test.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  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
  25. # xtensa needs uImage format for initrd
  26. # sheb network card get no ip
  27. adk_arch_list_uclibcng="arm armhf m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64 xtensa"
  28. adk_arch_list_uclibc="arm armhf m68k-nommu mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64"
  29. adk_arch_list_musl="arm armhf mips mipsel ppc-nofpu sh sheb x86 x86_64"
  30. adk_arch_list_glibc="aarch64 arm armhf mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64el mips64eln64 ppc-nofpu sh sheb sparc x86 x86_64"
  31. br_arch_list_uclibcng="bfin arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64 xtensa"
  32. br_arch_list_uclibc="bfin arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64 xtensa"
  33. br_arch_list_musl="arm mips mipsel ppc sh x86 x86_64"
  34. br_arch_list_glibc="aarch64 arm mips mipsel mips64 mips64el ppc sh sparc x86 x86_64"
  35. topdir=$(pwd)
  36. tools='make git wget xz cpio tar awk sed'
  37. f=0
  38. for tool in $tools; do
  39. if ! which $tool >/dev/null; then
  40. echo "Checking if $tool is installed... failed"
  41. f=1
  42. fi
  43. done
  44. if [ $f -eq 1 ];then exit 1; fi
  45. help() {
  46. cat >&2 <<EOF
  47. Syntax: $0 -v <vendor> -l <libc> -s <source> -a <arch>
  48. Explanation:
  49. -v: vendor for buildsystem (openadk|buildroot)
  50. -l: c library to use (uclibc-ng|musl|glibc|uclibc)
  51. -a: architecture to check
  52. -u: update vendor source via git pull
  53. -s: use directory with source for C library
  54. -d: enable debug
  55. -c: clean build directory before build
  56. -n: set NTP server for test run
  57. -b: only run basic bootup test
  58. -t: run libc testsuite
  59. -p: run Linux test project (LTP)
  60. -h: help text
  61. EOF
  62. }
  63. clean=0
  64. shell=0
  65. update=0
  66. debug=0
  67. boot=0
  68. ltp=0
  69. test=0
  70. gcc=0
  71. ntp=time.fu-berlin.de
  72. while getopts "hgptumdcbn:a:v:s:l:" ch; do
  73. case $ch in
  74. b)
  75. boot=1
  76. ;;
  77. p)
  78. ltp=1
  79. ;;
  80. t)
  81. test=1
  82. ;;
  83. m)
  84. shell=1
  85. ;;
  86. g)
  87. gcc=1
  88. ;;
  89. c)
  90. clean=1
  91. ;;
  92. u)
  93. update=1
  94. ;;
  95. s)
  96. source=$OPTARG
  97. ;;
  98. d)
  99. debug=1
  100. ;;
  101. l)
  102. libc=$OPTARG
  103. ;;
  104. n)
  105. ntp=$OPTARG
  106. ;;
  107. a)
  108. archlist=$OPTARG
  109. ;;
  110. v)
  111. vendor=$OPTARG
  112. ;;
  113. h)
  114. help
  115. exit 1
  116. ;;
  117. esac
  118. done
  119. shift $((OPTIND - 1))
  120. if [ -z $vendor ];then
  121. echo "You need to provide a vendor/buildsystem"
  122. echo "Either openadk or buildroot is supported."
  123. exit 1
  124. fi
  125. if [ -z $libc ];then
  126. echo "You need to provide a C library"
  127. echo "Either uclibc-ng, musl, glibc or uClibc is supported."
  128. exit 1
  129. fi
  130. case $libc in
  131. uclibc-ng)
  132. version=1.0.0beta5
  133. libver=uClibc-ng-${version}
  134. ;;
  135. uclibc)
  136. version=0.9.33.2
  137. libver=uClibc-${version}
  138. ;;
  139. glibc)
  140. version=2.19
  141. libver=glibc-${version}
  142. ;;
  143. musl)
  144. version=1.1.4
  145. libver=musl-${version}
  146. ;;
  147. *)
  148. echo "c library not supported"
  149. exit 1
  150. esac
  151. if [ -z $archlist ];then
  152. if [ $vendor = "openadk" ];then
  153. case $libc in
  154. uclibc-ng)
  155. archlist=$adk_arch_list_uclibcng
  156. ;;
  157. uclibc)
  158. archlist=$adk_arch_list_uclibc
  159. ;;
  160. glibc)
  161. archlist=$adk_arch_list_glibc
  162. ;;
  163. musl)
  164. archlist=$adk_arch_list_musl
  165. ;;
  166. *)
  167. exit 1
  168. ;;
  169. esac
  170. fi
  171. if [ $vendor = "buildroot" ];then
  172. case $libc in
  173. uclibc-ng)
  174. archlist=$br_arch_list_uclibcng
  175. ;;
  176. uclibc)
  177. archlist=$br_arch_list_uclibc
  178. ;;
  179. glibc)
  180. archlist=$br_arch_list_glibc
  181. ;;
  182. musl)
  183. archlist=$br_arch_list_musl
  184. ;;
  185. *)
  186. exit 1
  187. ;;
  188. esac
  189. fi
  190. fi
  191. case $vendor in
  192. openadk)
  193. echo "Using OpenADK to check $libc on $archlist"
  194. vendor_git=http://git.openadk.org/openadk.git
  195. ;;
  196. buildroot)
  197. echo "Using buildroot to check $libc on $archlist"
  198. vendor_git=http://git.buildroot.net/git/buildroot.git
  199. ;;
  200. *)
  201. echo "Vendor $vendor not supported"
  202. exit 1
  203. ;;
  204. esac
  205. if [ ! -d $vendor ];then
  206. git clone $vendor_git
  207. if [ $? -ne 0 ];then
  208. echo "Cloning from $vendor_git failed."
  209. exit 1
  210. fi
  211. if [ "$vendor" = "buildroot" ];then
  212. wget http://downloads.uclibc-ng.org/buildroot-uClibc-ng.patch
  213. (cd buildroot && patch -p1 <../buildroot-uClibc-ng.patch)
  214. fi
  215. else
  216. if [ $update -eq 1 ];then
  217. (cd $vendor && git pull)
  218. if [ $? -ne 0 ];then
  219. echo "Updating from $vendor_git failed."
  220. exit 1
  221. fi
  222. fi
  223. fi
  224. if [ ! -z $source ];then
  225. usrc=$(mktemp -d /tmp/XXXX)
  226. cp -a $source $usrc/$libver
  227. echo "Creating source tarball $vendor/dl/${libver}.tar.xz"
  228. mkdir -p $topdir/$vendor/dl 2>/dev/null
  229. (cd $usrc && tar cJf $topdir/$vendor/dl/${libver}.tar.xz ${libver} )
  230. fi
  231. runtest() {
  232. arch=$1
  233. qemu=qemu-system-${arch}
  234. qemu_args=
  235. qemu_append="ntp_server=$ntp"
  236. if [ $debug -eq 0 ];then
  237. qemu_append="$qemu_append quiet"
  238. fi
  239. if [ $shell -eq 1 ];then
  240. qemu_append="$qemu_append shell"
  241. fi
  242. suffix=
  243. psuffix=
  244. libdir=lib
  245. march=${arch}
  246. case ${arch} in
  247. arm)
  248. cpu_arch=arm
  249. qemu_machine=vexpress-a9
  250. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  251. suffix=eabi
  252. psuffix=$suffix
  253. ;;
  254. armhf)
  255. cpu_arch=arm
  256. march=arm
  257. qemu=qemu-system-${cpu_arch}
  258. qemu_machine=vexpress-a9
  259. qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118"
  260. suffix=eabihf
  261. psuffix=$suffix
  262. ;;
  263. mips)
  264. cpu_arch=mips
  265. qemu_machine=malta
  266. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  267. ;;
  268. mipsel)
  269. cpu_arch=mipsel
  270. march=mips
  271. qemu_machine=malta
  272. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  273. ;;
  274. mips64)
  275. cpu_arch=mips64
  276. qemu_machine=malta
  277. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  278. suffix=abi32
  279. psuffix=o32
  280. ;;
  281. mips64n32)
  282. cpu_arch=mips64
  283. march=mips64
  284. qemu=qemu-system-${cpu_arch}
  285. qemu_machine=malta
  286. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  287. suffix=abin32
  288. psuffix=n32
  289. ;;
  290. mips64n64)
  291. cpu_arch=mips64
  292. march=mips64
  293. qemu=qemu-system-${cpu_arch}
  294. qemu_machine=malta
  295. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  296. suffix=abi64
  297. psuffix=n64
  298. ;;
  299. mips64el)
  300. cpu_arch=mips64el
  301. march=mips64
  302. qemu_machine=malta
  303. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  304. suffix=abi32
  305. psuffix=o32
  306. ;;
  307. mips64eln32)
  308. cpu_arch=mips64el
  309. march=mips64
  310. qemu=qemu-system-${cpu_arch}
  311. qemu_machine=malta
  312. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  313. suffix=abin32
  314. psuffix=n32
  315. ;;
  316. mips64eln64)
  317. cpu_arch=mips64el
  318. march=mips64
  319. qemu=qemu-system-${cpu_arch}
  320. qemu_machine=malta
  321. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  322. suffix=abi64
  323. psuffix=n64
  324. ;;
  325. ppc-nofpu)
  326. cpu_arch=ppc
  327. march=ppc
  328. qemu=qemu-system-${cpu_arch}
  329. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  330. qemu_machine=bamboo
  331. ;;
  332. ppc)
  333. cpu_arch=ppc
  334. march=ppc
  335. qemu=qemu-system-${cpu_arch}
  336. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  337. qemu_machine=mac99
  338. ;;
  339. powerpc64|ppc64)
  340. cpu_arch=ppc64
  341. qemu=qemu-system-${cpu_arch}
  342. qemu_machine=pseries
  343. ;;
  344. sh)
  345. cpu_arch=sh4
  346. qemu=qemu-system-${cpu_arch}
  347. qemu_machine=r2d
  348. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  349. ;;
  350. sheb)
  351. cpu_arch=sh4eb
  352. march=sh
  353. qemu=qemu-system-${cpu_arch}
  354. qemu_machine=r2d
  355. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  356. ;;
  357. sparc)
  358. cpu_arch=sparc
  359. qemu_machine=SS-5
  360. ;;
  361. sparc64)
  362. cpu_arch=sparc64
  363. qemu_machine=sun4u
  364. qemu_args="${qemu_args} -net nic,model=virtio -net user"
  365. ;;
  366. x86)
  367. cpu_arch=i686
  368. qemu=qemu-system-i386
  369. qemu_machine=pc
  370. qemu_args="${qemu_args} -cpu pentium2"
  371. ;;
  372. x86_64)
  373. cpu_arch=x86_64
  374. qemu_machine=pc
  375. libdir=lib64
  376. ;;
  377. x86_64_x32)
  378. cpu_arch=x86_64
  379. qemu=qemu-system-${cpu_arch}
  380. qemu_machine=pc
  381. libdir=libx32
  382. suffix=x32
  383. ;;
  384. xtensa)
  385. cpu_arch=xtensa
  386. qemu=qemu-system-${cpu_arch}
  387. qemu_machine=lx60
  388. ;;
  389. *)
  390. echo "architecture ${arch} not supported"; exit 1;;
  391. esac
  392. if ! which $qemu >/dev/null; then
  393. echo "Checking if $qemu is installed... failed"
  394. exit 1
  395. fi
  396. qemuver=$(${qemu} -version|awk '{ print $4 }')
  397. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 200 ];then
  398. echo "Your qemu version is too old. Please update to 2.0 or greater"
  399. exit 1
  400. fi
  401. if [ "$libc" = "uclibc-ng" ];then
  402. prefix=uclibc
  403. else
  404. prefix=$libc
  405. fi
  406. cross=${cpu_arch}-${vendor}-linux-${prefix}${suffix}
  407. if [ -z $psuffix ];then
  408. TCPATH=${topdir}/${vendor}/toolchain_qemu-${march}_${libc}_${cpu_arch}
  409. else
  410. TCPATH=${topdir}/${vendor}/toolchain_qemu-${march}_${libc}_${cpu_arch}_${psuffix}
  411. fi
  412. export PATH="${TCPATH}/usr/bin:$PATH"
  413. if ! which ${cross}-gcc >/dev/null; then
  414. echo "Checking if ${cross}-gcc is installed... failed"
  415. exit 1
  416. fi
  417. echo "Starting test for ${arch}"
  418. echo "Generating root filesystem for test run"
  419. root=$(mktemp -d /tmp/XXXX)
  420. if [ ! -f openadk/firmware/qemu-${march}_${libc}/qemu-${march}-${libc}-initramfsarchive.tar.gz ];then
  421. echo "No root filesystem available for architecture ${arch}"
  422. exit 1
  423. fi
  424. tar -xf openadk/firmware/qemu-${march}_${libc}/qemu-${march}-${libc}-initramfsarchive.tar.gz -C $root
  425. if [ $2 -eq 0 ];then
  426. cat > ${root}/run.sh << EOF
  427. #!/bin/sh
  428. uname -a
  429. rdate -n \$ntp_server
  430. file /bin/busybox
  431. for i in \$(ls /lib/*.so|grep -v libgcc);do
  432. size \$i
  433. done
  434. exit
  435. EOF
  436. fi
  437. if [ $2 -eq 1 ];then
  438. cat > ${root}/run.sh << EOF
  439. #!/bin/sh
  440. uname -a
  441. rdate -n \$ntp_server
  442. /opt/ltp/runltp
  443. exit
  444. EOF
  445. fi
  446. if [ $2 -eq 2 ];then
  447. cat > ${root}/run.sh << EOF
  448. #!/bin/sh
  449. uname -a
  450. rdate -n \$ntp_server
  451. cd /opt/$libc/test
  452. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  453. exit
  454. EOF
  455. fi
  456. chmod u+x ${root}/run.sh
  457. kernel=openadk/firmware/qemu-${march}_${libc}/qemu-${march}-initramfsarchive-kernel
  458. echo "Creating initramfs filesystem"
  459. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  460. rm -rf $root
  461. echo "Now running the tests in qemu for architecture ${arch}"
  462. 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}"
  463. ${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}
  464. if [ $? -eq 0 ];then
  465. echo "Test for ${arch} finished. See REPORT.${arch}."
  466. echo
  467. else
  468. echo "Test failed for ${arch}."
  469. echo
  470. fi
  471. }
  472. create_buildroot_defconfig_arcle() {
  473. cat > configs/arcle_defconfig << EOD
  474. BR2_arcle=y
  475. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  476. BR2_KERNEL_HEADERS_3_15=y
  477. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  478. BR2_BINUTILS_VERSION_2_24=y
  479. BR2_GCC_VERSION_4_8_X=y
  480. BR2_TOOLCHAIN_HAS_THREADS=y
  481. EOD
  482. }
  483. create_buildroot_defconfig_arcbe() {
  484. cat > configs/arcbe_defconfig << EOD
  485. BR2_arcle=y
  486. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  487. BR2_KERNEL_HEADERS_3_15=y
  488. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  489. BR2_BINUTILS_VERSION_2_24=y
  490. BR2_GCC_VERSION_4_8_X=y
  491. BR2_TOOLCHAIN_HAS_THREADS=y
  492. EOD
  493. }
  494. create_buildroot_defconfig_bfin() {
  495. cat > configs/bfin_defconfig << EOD
  496. BR2_bfin=y
  497. BR2_BINFMT_FDPIC=y
  498. BR2_bf609=y
  499. BR2_TOOLCHAIN_BUILDROOT_UCLIBC_NG=y
  500. BR2_KERNEL_HEADERS_3_15=y
  501. BR2_DEFAULT_KERNEL_HEADERS="3.15.6"
  502. BR2_BINUTILS_VERSION_2_22=y
  503. BR2_GCC_VERSION_4_5_X=y
  504. BR2_TOOLCHAIN_HAS_THREADS=y
  505. EOD
  506. }
  507. build_buildroot() {
  508. cd buildroot
  509. case $1 in
  510. arcle)
  511. create_buildroot_defconfig_arcle
  512. make arcle_defconfig
  513. make clean all
  514. ;;
  515. arcbe)
  516. create_buildroot_defconfig_arcbe
  517. make arcbe_defconfig
  518. make clean all
  519. ;;
  520. arm)
  521. make qemu_arm_vexpress_defconfig
  522. make clean all
  523. ;;
  524. bfin)
  525. create_buildroot_defconfig_bfin
  526. make bfin_defconfig
  527. make clean all
  528. ;;
  529. mips)
  530. make qemu_mips_malta_defconfig
  531. make clean all
  532. ;;
  533. mipsel)
  534. make qemu_mipsel_malta_defconfig
  535. make clean all
  536. ;;
  537. mips64)
  538. make qemu_mips64_malta_defconfig
  539. make clean all
  540. ;;
  541. mips64el)
  542. make qemu_mips64el_malta_defconfig
  543. make clean all
  544. ;;
  545. ppc)
  546. make qemu_ppc_mpc8544ds_defconfig
  547. make clean all
  548. ;;
  549. sh)
  550. make qemu_sh4_r2d_defconfig
  551. make clean all
  552. ;;
  553. sparc)
  554. make qemu_sparc_ss10_defconfig
  555. make clean all
  556. ;;
  557. x86)
  558. make qemu_x86_defconfig
  559. make clean all
  560. ;;
  561. x86_64)
  562. make qemu_x86_64_defconfig
  563. make clean all
  564. ;;
  565. xtensa)
  566. make qemu_xtensa_lx60_defconfig
  567. make clean all
  568. ;;
  569. *)
  570. echo "architecture not supported in buildroot"
  571. exit 1
  572. ;;
  573. esac
  574. }
  575. build_openadk() {
  576. cd openadk
  577. # start with a clean dir
  578. if [ $clean -eq 1 ];then
  579. make cleandir
  580. fi
  581. DEFAULT="ADK_TARGET_LIBC=$libc ADK_TARGET_FS=initramfsarchive ADK_TARGET_COLLECTION=test"
  582. if [ $debug -eq 1 ];then
  583. DEFAULT="$DEFAULT VERBOSE=1"
  584. fi
  585. if [ ! -z $source ];then
  586. DEFAULT="$DEFAULT ADK_NO_CHECKSUM=1"
  587. fi
  588. if [ $2 -eq 0 ];then
  589. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  590. fi
  591. if [ $2 -eq 1 ];then
  592. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  593. fi
  594. if [ $2 -eq 2 ];then
  595. case $libc in
  596. uclibc-ng)
  597. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  598. ;;
  599. uclibc)
  600. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  601. ;;
  602. glibc)
  603. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  604. ;;
  605. musl)
  606. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  607. ;;
  608. *)
  609. echo "test suite not available"
  610. exit 1
  611. ;;
  612. esac
  613. make package=$libc clean
  614. fi
  615. if [ $2 -eq 3 ];then
  616. case $libc in
  617. uclibc-ng)
  618. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  619. ;;
  620. uclibc)
  621. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  622. ;;
  623. musl)
  624. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  625. ;;
  626. glibc)
  627. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  628. ;;
  629. *)
  630. echo "native build not available"
  631. exit 1
  632. ;;
  633. esac
  634. fi
  635. case $1 in
  636. arm)
  637. make $DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabi ADK_TARGET_ENDIAN=little defconfig all
  638. ;;
  639. armhf)
  640. make $DEFAULT ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_ABI=eabihf ADK_TARGET_ENDIAN=little defconfig all
  641. ;;
  642. m68k-nommu)
  643. make $DEFAULT ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k defconfig all
  644. ;;
  645. mips)
  646. make $DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big defconfig all
  647. ;;
  648. mipsel)
  649. make $DEFAULT ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little defconfig all
  650. ;;
  651. mips64)
  652. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32 defconfig all
  653. ;;
  654. mips64n32)
  655. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 defconfig all
  656. ;;
  657. mips64n64)
  658. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 defconfig all
  659. ;;
  660. mips64el)
  661. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32 defconfig all
  662. ;;
  663. mips64eln32)
  664. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 defconfig all
  665. ;;
  666. mips64eln64)
  667. make $DEFAULT ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 defconfig all
  668. ;;
  669. ppc-nofpu)
  670. make $DEFAULT ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc defconfig all
  671. ;;
  672. sh)
  673. make $DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little defconfig all
  674. ;;
  675. sheb)
  676. make $DEFAULT ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big defconfig all
  677. ;;
  678. *)
  679. make $DEFAULT ADK_TARGET_ARCH=$1 ADK_TARGET_SYSTEM=qemu-$1 defconfig all
  680. ;;
  681. esac
  682. if [ $? -ne 0 ];then
  683. echo "build failed"
  684. exit 1
  685. fi
  686. cd ..
  687. }
  688. echo "compiling base system and toolchain"
  689. if [ "$vendor" = "buildroot" ];then
  690. for arch in ${archlist}; do
  691. build_buildroot $arch 0
  692. done
  693. fi
  694. if [ "$vendor" = "openadk" ];then
  695. for arch in ${archlist}; do
  696. build_openadk $arch 99
  697. if [ $boot -eq 1 ];then
  698. case $arch in
  699. m68k-nommu|ppc|sheb|xtensa|mips64eln32|mips64n32)
  700. echo "runtime tests disabled for $arch."
  701. ;;
  702. *)
  703. build_openadk $arch 0
  704. runtest $arch 0
  705. ;;
  706. esac
  707. fi
  708. if [ $ltp -eq 1 ];then
  709. case $arch in
  710. m68k-nommu|ppc|sheb|xtensa|mips64eln32|mips64n32)
  711. echo "runtime tests disabled for $arch."
  712. ;;
  713. *)
  714. build_openadk $arch 1
  715. runtest $arch 1
  716. ;;
  717. esac
  718. fi
  719. if [ $test -eq 1 ];then
  720. case $arch in
  721. m68k-nommu|ppc|sheb|xtensa|mips64eln32|mips64n32)
  722. echo "runtime tests disabled for $arch."
  723. ;;
  724. *)
  725. build_openadk $arch 2
  726. runtest $arch 2
  727. ;;
  728. esac
  729. fi
  730. if [ $gcc -eq 1 ];then
  731. case $arch in
  732. m68k-nommu|ppc|sheb|xtensa|mips64eln32|mips64n32)
  733. echo "runtime tests disabled for $arch."
  734. ;;
  735. *)
  736. build_openadk $arch 3
  737. runtest $arch 3
  738. ;;
  739. esac
  740. fi
  741. done
  742. fi
  743. echo "All tests finished."
  744. exit 0