view more/cross-smoke-test.sh @ 1391:42ec661e3916

Fix BINARY_PACKAGE_TARBALLS generation: some packages produce no output (zlib used to build dropbear for example), and thus check for an empty list before trying to make a tarball.
author Rob Landley <rob@landley.net>
date Fri, 17 Jun 2011 13:00:17 -0500
parents e34c00072500
children b74d36876c0a
line wrap: on
line source

#!/bin/bash

# Perform a smoke test on a target's cross compiler by building "hello world"
# and attempting to run it under QEMU application emulation.

source sources/include.sh && read_arch_dir "$1" || exit 1

# Build statically linked hello world, if necessary

if [ ! -e "$WORK/hello" ]
then
  "${ARCH}-gcc" -Os -static "${SOURCES}/toys/hello.c" -o "$WORK"/hello

  if [ $? -ne 0 ]
  then
    echo "Compiler doesn't seem to work" >&2
    dienow
  fi
fi

# Attempt to run statically linked hello world

RESULT="$(PATH="$OLDPATH" qemu-"$QEMU_TEST" "$WORK/hello")"
if [ "$RESULT" == "Hello world!" ]
then
  echo "Cross toolchain seems to work."
  exit 0
else
  echo "Can't run hello world" >&2
  exit 1
fi