[gardening] Use grep -q instead of comparing output with [ -n .. ]

This commit is contained in:
practicalswift
2017-02-23 22:12:52 +01:00
parent efb4183c8f
commit 8590e2cbbc
2 changed files with 4 additions and 4 deletions

View File

@@ -13,14 +13,14 @@ set -u
# REQUIRES: OS=macosx
# RUN: %s %swift_obj_root
if [[ -n "$(find $1/lib -iname '*.cpp.o' -type f -exec file {} \; | grep -v -e bitcode -e bit-code)" ]]; then
if find $1/lib -iname '*.cpp.o' -type f -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
echo "Found a ./lib non-bitcode object file!"
exit 1
else
echo "All ./lib object files are bit-code files!"
fi
if [[ -n "$(find $1/unittests -iname '*.cpp.o' -type f -exec file {} \; | grep -v -e bitcode -e bit-code)" ]]; then
if find $1/unittests -iname '*.cpp.o' -type f -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
echo "Found a ./unittests non-bitcode object file!"
exit 1
else

View File

@@ -34,7 +34,7 @@ function check_thin_archive_for_bitcode() {
mkdir -p "${LIB_TEMP_DIR}"
cd "${LIB_TEMP_DIR}"
ar -x ${ARCHIVE}
if [[ -n "$(find ./ -iname '*.o' -exec file {} \; | grep -e bitcode -e bit-code)" ]]; then
if find ./ -iname '*.o' -exec file {} \; | grep -q -v -e bitcode -e bit-code; then
echo "Found bitcode file in thin archive: ${ARCHIVE}"
exit 1
else
@@ -78,7 +78,7 @@ function check_thick_archive_for_bitcode() {
cd ${arch}
ar -x "${LIB_ARCHIVE_DIR}/${THIN_ARCHIVE}"
if [[ -n "$(find ./ -iname '*.o' -exec file {} \; | grep -e bitcode -e bit-code)" ]]; then
if find ./ -iname '*.o' -exec file {} \; | grep -q -e bitcode -e bit-code; then
echo "Found bitcode file in thin archive: ${THIN_ARCHIVE}. Taken from thick archive: ${ARCHIVE}"
exit 1
else