xref: /openbmc/u-boot/test/stdint/test-includes.sh (revision 7e86242b)
1#!/bin/bash
2
3# Test script to check uintptr_t and 64-bit types for warnings
4#
5# It builds a few boards with different toolchains. If there are no warnings
6# then all is well.
7#
8# Usage:
9#
10# Make sure that your toolchains are correct at the bottom of this file
11#
12# Then:
13#	./test/stdint/test-includes.sh
14
15out=/tmp/test-includes.tmp
16
17try_test() {
18	local board=$1
19	local arch=$2
20	local soc=$3
21	local gcc=$4
22	local flags="$5"
23
24	echo $@
25	if ! which ${gcc} >/dev/null 2>&1; then
26		echo "Not found: ${gcc}"
27		return
28	fi
29
30	rm -rf ${out}
31	mkdir -p ${out}
32	touch ${out}/config.h
33	mkdir -p ${out}/generated
34	touch ${out}/generated/generic-asm-offsets.h
35	mkdir -p ${out}/include/asm
36	ln -s $(pwd)/arch/${arch}/include/asm/arch-${soc} \
37			${out}/include/asm/arch
38
39	cmd="${gcc} -c -D__KERNEL__ ${flags} \
40		-fno-builtin -ffreestanding \
41		-Iarch/${arch}/include \
42		-Iinclude \
43		-I${out} -I${out}/include \
44		-include configs/${board}.h test/stdint/int-types.c \
45		-o /dev/null"
46	$cmd
47}
48
49# Run a test with and without CONFIG_USE_STDINT
50try_both() {
51	try_test $@
52	try_test $@ -DCONFIG_USE_STDINT
53}
54
55# board arch soc path-to-gcc
56try_both sandbox sandbox - gcc
57try_both coreboot x86 - x86_64-linux-gnu-gcc
58try_both seaboard arm tegra20 /opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/bin/arm-linux-gnueabihf-gcc
59