embedded-test.sh 20 KB

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