embedded-test.sh 19 KB

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