embedded-test.sh 20 KB

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