embedded-test.sh 20 KB

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