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