#!/bin/sh -x # Smoke tests a Swift installation package. # Set these to the paths of the OS X SDK and toolchain. SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain # FIXME: OSX 10.9 bug : TMPDIR doesn't get set sometimes. if [ ! "$TMPDIR" ]; then TMPDIR=/tmp fi # Wipe out stale module caches. find "$TMPDIR" -name "*.pcm" -exec rm '{}' ';' find /var/tmp -name "*.pcm" -exec rm '{}' ';' find /tmp -name "*.pcm" -exec rm '{}' ';' find "$(getconf DARWIN_USER_CACHE_DIR)" -name "*.pcm" -exec rm '{}' ';' # The package name should be given as the first argument. PACKAGE_NAME="$1" if [ \! "$PACKAGE_NAME" ]; then echo "No package name given! Usage: $0 package.tar.gz" exit 1 elif [ \! -f "$PACKAGE_NAME" ]; then echo "Package $PACKAGE_NAME does not exist!" exit 1 fi # We use a sudoable script to darwinup install and uninstall the # package. INSTALL_PACKAGE_HELPER="$(dirname "$0")/install-package-helper.sh" if [ \! -x "$INSTALL_PACKAGE_HELPER" ]; then echo "Unable to find package installer helper $INSTALL_PACKAGE_HELPER!" exit 1 fi # Install the package. if ! sudo -n "$INSTALL_PACKAGE_HELPER" install "$PACKAGE_NAME"; then echo "Failed to install package!" exit 1 fi # # Do tests. # # Ensure that basic REPL stuff works. # FIXME: REPL bug--when stdout is redirected but stderr is a terminal, no # output appears on stdout. RESULT=0 if ! /usr/bin/swift -repl 2>"$TMPDIR/test_repl_1_err_$$" >"$TMPDIR/test_repl_1_$$" <"$TMPDIR/test_repl_2_err_$$" >"$TMPDIR/test_repl_2_$$" <"$TMPDIR/test_compile_$$.swift" <