embedded-test.sh 20 KB

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