embedded-test.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. #!/bin/sh
  2. # Copyright © 2014-2015
  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. # sheb network card get no ip
  25. # sparc64 network card does not work right
  26. # ppc-nofpu problem with busybox sort, broken startup order for glibc
  27. arch_list_uclibcng="arm armhf armeb arc arcbe avr32 bfin c6x cris m68k 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 armeb arc arcbe bfin mips mipsel ppc-nofpu sh sheb sparc x86 x86_64"
  29. arch_list_musl="arm armhf armeb microblazeel microblazebe mips mipsel ppc-nofpu sh sheb x86 x86_64"
  30. arch_list_glibc="aarch64 arm armhf armeb m68k microblazeel microblazebe mips mipsel mips64 mips64eln32 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 nios2 ppc-nofpu ppc64 sh sheb sparc sparc64 tile 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. -f: enable fast compile, after a failure no rebuild
  52. -d: enable debug output from OpenADK
  53. -c: clean OpenADK build directory before build
  54. -n: set NTP server for test run
  55. -t: run tests (boot|libc|ltp|native)
  56. -p: add extra packages to build
  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. fast=0
  67. ntp=time.fu-berlin.de
  68. while getopts "hfgumdcn: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. f)
  83. fast=1
  84. ;;
  85. u)
  86. update=1
  87. ;;
  88. s)
  89. source=$OPTARG
  90. ;;
  91. l)
  92. libc=$OPTARG
  93. ;;
  94. n)
  95. ntp=$OPTARG
  96. ;;
  97. a)
  98. archtolist=$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. microblazeel)
  171. cpu_arch=microblazeel
  172. march=microblaze
  173. qemu_machine=petalogix-s3adsp1800
  174. ;;
  175. microblazebe)
  176. cpu_arch=microblazebe
  177. march=microblaze
  178. qemu=qemu-system-${march}
  179. qemu_machine=petalogix-s3adsp1800
  180. ;;
  181. mips)
  182. cpu_arch=mips
  183. qemu_machine=malta
  184. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  185. ;;
  186. mipsel)
  187. cpu_arch=mipsel
  188. march=mips
  189. qemu_machine=malta
  190. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  191. ;;
  192. mips64)
  193. cpu_arch=mips64
  194. qemu_machine=malta
  195. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  196. suffix=abi32
  197. psuffix=o32
  198. ;;
  199. mips64n32)
  200. cpu_arch=mips64
  201. march=mips64
  202. qemu=qemu-system-${cpu_arch}
  203. qemu_machine=malta
  204. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  205. suffix=abin32
  206. psuffix=n32
  207. ;;
  208. mips64n64)
  209. cpu_arch=mips64
  210. march=mips64
  211. qemu=qemu-system-${cpu_arch}
  212. qemu_machine=malta
  213. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  214. suffix=abi64
  215. psuffix=n64
  216. ;;
  217. mips64el)
  218. cpu_arch=mips64el
  219. march=mips64
  220. qemu_machine=malta
  221. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  222. suffix=abi32
  223. psuffix=o32
  224. ;;
  225. mips64eln32)
  226. cpu_arch=mips64el
  227. march=mips64
  228. qemu=qemu-system-${cpu_arch}
  229. qemu_machine=malta
  230. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  231. suffix=abin32
  232. psuffix=n32
  233. ;;
  234. mips64eln64)
  235. cpu_arch=mips64el
  236. march=mips64
  237. qemu=qemu-system-${cpu_arch}
  238. qemu_machine=malta
  239. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  240. suffix=abi64
  241. psuffix=n64
  242. ;;
  243. ppc-nofpu)
  244. cpu_arch=ppc
  245. march=ppc
  246. qemu=qemu-system-${cpu_arch}
  247. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  248. qemu_machine=bamboo
  249. ;;
  250. ppc)
  251. cpu_arch=ppc
  252. march=ppc
  253. qemu=qemu-system-${cpu_arch}
  254. qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
  255. qemu_machine=mac99
  256. ;;
  257. powerpc64|ppc64)
  258. cpu_arch=ppc64
  259. qemu=qemu-system-${cpu_arch}
  260. qemu_machine=pseries
  261. ;;
  262. sh)
  263. cpu_arch=sh4
  264. qemu=qemu-system-${cpu_arch}
  265. qemu_machine=r2d
  266. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  267. ;;
  268. sheb)
  269. cpu_arch=sh4eb
  270. march=sh
  271. qemu=qemu-system-${cpu_arch}
  272. qemu_machine=r2d
  273. qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
  274. ;;
  275. sparc)
  276. cpu_arch=sparc
  277. qemu_machine=SS-5
  278. ;;
  279. sparc64)
  280. cpu_arch=sparc64
  281. qemu_machine=sun4u
  282. qemu_args="${qemu_args} -device ne2k_pci,netdev=adk0 -netdev user,id=adk0"
  283. ;;
  284. x86)
  285. cpu_arch=i486
  286. qemu=qemu-system-i386
  287. qemu_machine=pc
  288. qemu_args="${qemu_args}"
  289. ;;
  290. x86_64)
  291. cpu_arch=x86_64
  292. qemu_machine=pc
  293. libdir=lib64
  294. ;;
  295. x86_64_x32)
  296. cpu_arch=x86_64
  297. qemu=qemu-system-${cpu_arch}
  298. qemu_machine=pc
  299. libdir=libx32
  300. suffix=x32
  301. ;;
  302. xtensa)
  303. cpu_arch=xtensa
  304. qemu=qemu-system-${cpu_arch}
  305. qemu_machine=lx60
  306. qemu_args="${qemu_args} -cpu dc233c"
  307. ;;
  308. *)
  309. echo "architecture ${arch} not supported"; exit 1;;
  310. esac
  311. if ! which $qemu >/dev/null; then
  312. echo "Checking if $qemu is installed... failed"
  313. exit 1
  314. fi
  315. qemuver=$(${qemu} -version|awk '{ print $4 }')
  316. if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 210 ];then
  317. echo "Your qemu version is too old. Please update to 2.1 or greater"
  318. exit 1
  319. fi
  320. echo "Starting test for $lib and ${arch}"
  321. echo "Generating root filesystem for test run"
  322. root=$(mktemp -d /tmp/XXXX)
  323. if [ ! -f openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.xz ];then
  324. echo "No root filesystem available for architecture ${arch}"
  325. exit 1
  326. fi
  327. tar -xf openadk/firmware/qemu-${march}_${lib}/qemu-${march}-${lib}-initramfsarchive.tar.xz -C $root
  328. if [ $test = "boot" ];then
  329. cat > ${root}/run.sh << EOF
  330. #!/bin/sh
  331. uname -a
  332. rdate -n \$ntp_server
  333. file /bin/busybox
  334. for i in \$(ls /lib/*.so|grep -v libgcc);do
  335. size \$i
  336. done
  337. exit
  338. EOF
  339. fi
  340. if [ $test = "ltp" ];then
  341. cat > ${root}/run.sh << EOF
  342. #!/bin/sh
  343. uname -a
  344. rdate -n \$ntp_server
  345. /opt/ltp/runltp
  346. exit
  347. EOF
  348. fi
  349. if [ $test = "libc" ];then
  350. case $lib in
  351. uclibc-ng|uclibc)
  352. cat > ${root}/run.sh << EOF
  353. #!/bin/sh
  354. uname -a
  355. rdate -n \$ntp_server
  356. cd /opt/*/test
  357. CROSS_COMPILE=": ||" make UCLIBC_ONLY=y -k run
  358. exit
  359. EOF
  360. ;;
  361. musl|glibc)
  362. cat > ${root}/run.sh << EOF
  363. #!/bin/sh
  364. uname -a
  365. rdate -n \$ntp_server
  366. cd /opt/libc-test
  367. make run
  368. exit
  369. EOF
  370. ;;
  371. esac
  372. fi
  373. chmod u+x ${root}/run.sh
  374. kernel=openadk/firmware/qemu-${march}_${lib}/qemu-${march}-initramfsarchive-kernel
  375. echo "Creating initramfs filesystem"
  376. (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
  377. rm -rf $root
  378. echo "Now running the test ${test} in qemu for architecture ${arch} and ${lib}"
  379. 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}"
  380. ${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}
  381. if [ $? -eq 0 ];then
  382. echo "Test ${test} for ${arch} finished. See REPORT.${arch}.${lib}.${test}.${version}"
  383. echo
  384. else
  385. echo "Test ${test} failed for ${arch} with ${lib} ${version}."
  386. echo
  387. fi
  388. }
  389. compile() {
  390. rm .config* .defconfig 2>/dev/null
  391. make $1 defconfig
  392. for pkg in $pkgs; do p=$(echo $pkg|tr '[:lower:]' '[:upper:]');printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y" >> .config;done
  393. make $1 all
  394. }
  395. build() {
  396. lib=$1
  397. arch=$2
  398. test=$3
  399. cd openadk
  400. make prereq
  401. # always trigger regeneration of kernel config
  402. rm build_*_${lib}_${arch}*/linux/.config > /dev/null 2>&1
  403. # download and rebuild C library package
  404. if [ $fast -eq 0 ];then
  405. rm dl/$lib*
  406. make package=$lib clean > /dev/null 2>&1
  407. fi
  408. DEFAULT="ADK_TARGET_LIBC=$lib ADK_TARGET_FS=initramfsarchive"
  409. if [ $debug -eq 1 ];then
  410. DEFAULT="$DEFAULT ADK_VERBOSE=1"
  411. fi
  412. if [ $git -eq 1 ];then
  413. DEFAULT="$DEFAULT ADK_LIBC_GIT=y"
  414. fi
  415. if [ $test = "boot" ];then
  416. DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  417. fi
  418. if [ $test = "ltp" ];then
  419. DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  420. fi
  421. if [ $test = "libc" ];then
  422. case $lib in
  423. uclibc-ng)
  424. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TESTSUITE=y"
  425. ;;
  426. uclibc)
  427. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_TESTSUITE=y"
  428. ;;
  429. glibc)
  430. DEFAULT="$DEFAULT ADK_TEST_GLIBC_TESTSUITE=y"
  431. ;;
  432. musl)
  433. DEFAULT="$DEFAULT ADK_TEST_MUSL_TESTSUITE=y"
  434. ;;
  435. esac
  436. fi
  437. if [ $test = "native" ];then
  438. case $lib in
  439. uclibc-ng)
  440. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
  441. ;;
  442. uclibc)
  443. DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NATIVE=y"
  444. ;;
  445. musl)
  446. DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
  447. ;;
  448. glibc)
  449. DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
  450. ;;
  451. esac
  452. fi
  453. case $arch in
  454. aarch64)
  455. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=qemu-aarch64"
  456. compile "$DEFAULT"
  457. ;;
  458. arc)
  459. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=little"
  460. compile "$DEFAULT"
  461. ;;
  462. arcbe)
  463. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arc ADK_TARGET_SYSTEM=toolchain-arc ADK_TARGET_ENDIAN=big"
  464. compile "$DEFAULT"
  465. ;;
  466. arm)
  467. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=little"
  468. compile "$DEFAULT"
  469. ;;
  470. armeb)
  471. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=toolchain-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
  472. compile "$DEFAULT"
  473. ;;
  474. armhf)
  475. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=arm ADK_TARGET_SYSTEM=qemu-arm ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=little"
  476. compile "$DEFAULT"
  477. ;;
  478. avr32)
  479. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=toolchain-avr32"
  480. compile "$DEFAULT"
  481. ;;
  482. bfin)
  483. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=toolchain-bfin"
  484. compile "$DEFAULT"
  485. ;;
  486. c6x)
  487. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=toolchain-c6x"
  488. compile "$DEFAULT"
  489. ;;
  490. cris)
  491. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=toolchain-cris"
  492. compile "$DEFAULT"
  493. ;;
  494. m68k)
  495. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=aranym-m68k"
  496. compile "$DEFAULT"
  497. ;;
  498. m68k-nommu)
  499. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=m68k ADK_TARGET_SYSTEM=qemu-m68k"
  500. compile "$DEFAULT"
  501. ;;
  502. microblazebe)
  503. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=big"
  504. compile "$DEFAULT"
  505. ;;
  506. microblazeel)
  507. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=microblaze ADK_TARGET_SYSTEM=qemu-microblaze ADK_TARGET_ENDIAN=little"
  508. compile "$DEFAULT"
  509. ;;
  510. mips)
  511. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big"
  512. compile "$DEFAULT"
  513. ;;
  514. mipsel)
  515. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little"
  516. compile "$DEFAULT"
  517. ;;
  518. mips64)
  519. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32"
  520. compile "$DEFAULT"
  521. ;;
  522. mips64n32)
  523. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32"
  524. compile "$DEFAULT"
  525. ;;
  526. mips64n64)
  527. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64"
  528. compile "$DEFAULT"
  529. ;;
  530. mips64el)
  531. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32"
  532. compile "$DEFAULT"
  533. ;;
  534. mips64eln32)
  535. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32"
  536. compile "$DEFAULT"
  537. ;;
  538. mips64eln64)
  539. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=mips64 ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64"
  540. compile "$DEFAULT"
  541. ;;
  542. nios2)
  543. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=toolchain-nios2"
  544. compile "$DEFAULT"
  545. ;;
  546. ppc-nofpu)
  547. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=ppc ADK_TARGET_SYSTEM=qemu-ppc"
  548. compile "$DEFAULT"
  549. ;;
  550. sh)
  551. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
  552. compile "$DEFAULT"
  553. ;;
  554. sheb)
  555. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
  556. compile "$DEFAULT"
  557. ;;
  558. tile)
  559. DEFAULT="$DEFAULT ADK_APPLIANCE=new ADK_TARGET_ARCH=tile ADK_TARGET_SYSTEM=toolchain-tile"
  560. compile "$DEFAULT"
  561. ;;
  562. *)
  563. DEFAULT="$DEFAULT ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=qemu-$arch"
  564. compile "$DEFAULT"
  565. ;;
  566. esac
  567. if [ $? -ne 0 ];then
  568. echo "build failed"
  569. exit 1
  570. fi
  571. cd ..
  572. }
  573. for lib in ${libc}; do
  574. case $lib in
  575. uclibc-ng)
  576. archlist=$arch_list_uclibcng
  577. version=1.0.1
  578. gitversion=git
  579. if [ $git -eq 1 ]; then
  580. libver=uClibc-ng-${gitversion}
  581. else
  582. libver=uClibc-ng-${version}
  583. fi
  584. libdir=uClibc-ng
  585. ;;
  586. uclibc)
  587. archlist=$arch_list_uclibc
  588. version=0.9.33.2
  589. gitversion=0.9.34-git
  590. if [ $git -eq 1 ]; then
  591. libver=uClibc-${gitversion}
  592. else
  593. libver=uClibc-${version}
  594. fi
  595. libdir=uClibc
  596. ;;
  597. glibc)
  598. archlist=$arch_list_glibc
  599. version=2.21
  600. gitversion=2.21.90
  601. if [ $git -eq 1 ]; then
  602. libver=glibc-${gitversion}
  603. else
  604. libver=glibc-${version}
  605. fi
  606. libdir=glibc
  607. ;;
  608. musl)
  609. archlist=$arch_list_musl
  610. version=1.1.7
  611. gitversion=git
  612. if [ $git -eq 1 ]; then
  613. libver=musl-${gitversion}
  614. else
  615. libver=musl-${version}
  616. fi
  617. libdir=musl
  618. ;;
  619. esac
  620. if [ ! -z $archtolist ];then
  621. archlist="$archtolist"
  622. fi
  623. if [ ! -z $source ];then
  624. if [ ! -d $source ];then
  625. echo "Not a directory."
  626. exit 1
  627. fi
  628. if [ $fast -eq 0 ];then
  629. usrc=$(mktemp -d /tmp/XXXX)
  630. echo "Creating source tarball openadk/dl/${libver}.tar.xz"
  631. cp -a $source $usrc/$libver
  632. mkdir -p $topdir/openadk/dl 2>/dev/null
  633. rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
  634. (cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} )
  635. touch $topdir/openadk/dl/${libver}.tar.xz.nohash
  636. fi
  637. fi
  638. echo "Architectures to test: $archlist"
  639. for arch in ${archlist}; do
  640. # start with a clean dir
  641. if [ $clean -eq 1 ];then
  642. (cd openadk && make cleandir)
  643. fi
  644. echo "Compiling base system and toolchain for $lib and $arch"
  645. build $lib $arch notest
  646. if [ ! -z "$tests" ];then
  647. for test in ${tests}; do
  648. if [ $test = "boot" -o $test = "libc" -o $test = "ltp" -o $test = "native" ];then
  649. case $lib in
  650. uclibc-ng)
  651. case $arch in
  652. arc|arcbe|armeb|avr32|bfin|c6x|cris|microblazeel|microblazebe|m68k|m68k-nommu|nios2|ppc|sheb)
  653. echo "runtime tests disabled for $arch."
  654. ;;
  655. *)
  656. build $lib $arch $test
  657. runtest $lib $arch $test
  658. ;;
  659. esac
  660. ;;
  661. uclibc)
  662. case $arch in
  663. arc|arcbe|armeb|avr32|bfin|cris|m68k|m68k-nommu|ppc|ppc-nofpu|sheb|sparc|sparc64|mips64eln32|mips64n32)
  664. echo "runtime tests disabled for $arch."
  665. ;;
  666. *)
  667. build $lib $arch $test
  668. runtest $lib $arch $test
  669. ;;
  670. esac
  671. ;;
  672. musl)
  673. case $arch in
  674. armeb|ppc|ppc-nofpu|sheb)
  675. echo "runtime tests disabled for $arch."
  676. ;;
  677. *)
  678. build $lib $arch $test
  679. runtest $lib $arch $test
  680. ;;
  681. esac
  682. ;;
  683. glibc)
  684. case $arch in
  685. armeb|m68k|nios2|ppc|ppc-nofpu|sheb|sparc64|tile)
  686. echo "runtime tests disabled for $arch."
  687. ;;
  688. *)
  689. build $lib $arch $test
  690. runtest $lib $arch $test
  691. ;;
  692. esac
  693. ;;
  694. esac
  695. else
  696. echo "Test $test is not valid. Allowed tests: boot libc ltp native"
  697. exit 1
  698. fi
  699. done
  700. fi
  701. done
  702. done
  703. echo "All tests finished."
  704. exit 0