embedded-test.sh 20 KB

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