#!/bin/sh
CMD=SecurityTests.app/SecurityTests
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
INSTALL_DIR=/tmp
RSYNC_URL=rsync://root@localhost:10873/root${INSTALL_DIR}
export RSYNC_PASSWORD=alpine
echo "run_tests.sh:${LINENO}: note: Copying stuff to device"
/usr/bin/rsync -cav ${CONFIGURATION_BUILD_DIR}/Security.framework ${RSYNC_URL}
/usr/bin/rsync -cav ${CONFIGURATION_BUILD_DIR}/SecurityTests.app ${RSYNC_URL}
echo "run_tests.sh:${LINENO}: note: Running the test"
xcrun -sdk "$SDKROOT" PurpleExec --env "DYLD_FRAMEWORK_PATH=${INSTALL_DIR}" --cmd ${INSTALL_DIR}/${CMD}
else
echo "run_tests.sh:${LINENO}: note: Running test on simulator (${BUILT_PRODUCTS_DIR}/${CMD})"
export DYLD_ROOT_PATH="${SDKROOT}"
export DYLD_LIBRARY_PATH="${BUILT_PRODUCTS_DIR}"
export DYLD_FRAMEWORK_PATH="${BUILT_PRODUCTS_DIR}"
${BUILT_PRODUCTS_DIR}/${CMD}
fi