embedded-test.sh 18 KB

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