Skip to content

Commit

Permalink
Attempt to get analyser running with SIP enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Oct 28, 2018
1 parent 27f2c74 commit b35c5bf
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ matrix:
script:
- xcodebuild -configuration Debug
- xcodebuild -configuration Release
- xcodebuild analyze -quiet -configuration Debug CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]
- xcodebuild analyze -quiet -configuration Release CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]
- xcodebuild analyze -quiet -scheme Lilu -configuration Debug CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]
- xcodebuild analyze -quiet -scheme Lilu -configuration Release CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]

deploy:
provider: releases
Expand All @@ -26,7 +26,6 @@ matrix:
tags: true

- os: osx
osx_image: xcode6.4
compiler: clang

script:
Expand All @@ -38,5 +37,6 @@ matrix:
name: "acidanthera/Lilu"
description: "Lilu"
notification_email: $NOTIFICATION_EMAIL
build_command_prepend: "src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh) && eval \"$src\" || exit 1"
build_command: "xcodebuild -configuration Release"
branch_pattern: master
25 changes: 25 additions & 0 deletions Lilu/Scripts/cov-cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

#
# cov-cc
# Lilu
#
# Copyright © 2018 vit9696. All rights reserved.
#

if [ "${COVERITY_CC}" = "" ]; then
COVERITY_CC="/usr/bin/clang"
fi

if [ "${COVERITY_RESULTS_DIR}" = "" ]; then
COVERITY_RESULTS_DIR="cov-int"
fi

if [ "${COVERITY_CC_LOG}" != "" ]; then
touch "${COVERITY_CC_LOG}"
echo "${COVERITY_CC} $@" >> "${COVERITY_CC_LOG}"
fi

# Make sure compiler code is always returned and do not mess with other tools!
cov-translate --dir "${COVERITY_RESULTS_DIR}" "${COVERITY_CC}" "$@" &>/dev/null
"${COVERITY_CC}" "$@"
10 changes: 10 additions & 0 deletions Lilu/Scripts/cov-csrutil
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

#
# cov-csrutil
# Lilu
#
# Copyright © 2018 vit9696. All rights reserved.
#

echo 'System Integrity Protection status: disabled.'
25 changes: 25 additions & 0 deletions Lilu/Scripts/cov-cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

#
# cov-cxx
# Lilu
#
# Copyright © 2018 vit9696. All rights reserved.
#

if [ "${COVERITY_CXX}" = "" ]; then
COVERITY_CXX="/usr/bin/clang++"
fi

if [ "${COVERITY_RESULTS_DIR}" = "" ]; then
COVERITY_RESULTS_DIR="cov-int"
fi

if [ "${COVERITY_CXX_LOG}" != "" ]; then
touch "${COVERITY_CXX_LOG}"
echo "${COVERITY_CXX} $@" >> "${COVERITY_CXX_LOG}"
fi

# Make sure compiler code is always returned and do not mess with other tools!
cov-translate --dir "${COVERITY_RESULTS_DIR}" "${COVERITY_CXX}" "$@" &>/dev/null
"${COVERITY_CXX}" "$@"
127 changes: 127 additions & 0 deletions Lilu/Scripts/covstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash

#
# covstrap.sh
# Lilu
#
# Copyright © 2018 vit9696. All rights reserved.
#

#
# This script is supposed to quickly bootstrap Coverity Scan environment for Travis CI
# to be later used with Lilu and plugins.
#
# Latest version available at:
# https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh
#
# Example usage:
# src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh) && eval "$src" || exit 1
#

PROJECT_PATH="$(pwd)"
if [ $? -ne 0 ] || [ ! -d "${PROJECT_PATH}" ]; then
echo "ERROR: Failed to determine working directory!"
exit 1
fi

# Avoid conflicts with PATH overrides.
CHMOD="/bin/chmod"
CURL="/usr/bin/curl"
MKDIR="/bin/mkdir"
RM="/bin/rm"

TOOLS=(
"${CHMOD}"
"${CURL}"
"${MKDIR}"
"${RM}"
)

for tool in "${TOOLS[@]}"; do
if [ ! -x "${tool}" ]; then
echo "ERROR: Missing ${tool}!"
exit 1
fi
done

# Coverity compatibility tools
COV_TOOLS_URL="https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts"
COV_TOOLS=(
"cov-cc"
"cov-cxx"
"cov-csrutil"
)

COV_OVERRIDES=(
"clang"
"clang++"
"gcc"
"g++"
)

COV_OVERRIDES_TARGETS=(
"cov-cc"
"cov-cxx"
"cov-cc"
"cov-cxx"
)

COV_OVERRIDE_NUM="${#COV_OVERRIDES[@]}"

# Export override variables
export COVERITY_RESULTS_DIR="${PROJECT_PATH}/cov-int"
export COVERITY_TOOLS_DIR="${PROJECT_PATH}/cov-tools"

export COVERITY_CSRUTIL_PATH="${COVERITY_TOOLS_DIR}/cov-csrutil"
export CC="${COVERITY_TOOLS_DIR}/cov-cc"
export CXX="${COVERITY_TOOLS_DIR}/cov-cxx"

# Prepare directory structure
ret=0
"${RM}" -rf "${COVERITY_TOOLS_DIR}"
"${MKDIR}" "${COVERITY_TOOLS_DIR}" || ret=$?

if [ $ret -ne 0 ]; then
echo "ERROR: Failed to create cov-tools directory ${COVERITY_TOOLS_DIR} with code ${ret}!"
exit 1
fi

# Prepare tools
cd cov-tools || exit 1

# Download tools to override
for tool in "${COV_TOOLS[@]}"; do
url="${COV_TOOLS_URL}/${tool}"
"${CURL}" -LfsO "${url}" || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to download ${tool} with code ${ret}!"
exit 1
fi
"${CHMOD}" a+x "${tool}" || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to chmod ${tool} with code ${ret}!"
exit 1
fi
done

# Generate compiler tools PATH overrides
for ((i=0; $i<$COV_OVERRIDE_NUM; i++)); do
tool="${COV_OVERRIDES[$i]}"
target="${COV_OVERRIDES_TARGETS[$i]}"
echo "${target} \"\$@\"" > "${tool}" || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to generate ${tool} override to ${target} with code ${ret}!"
exit 1
fi
"${CHMOD}" a+x "${tool}" || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: Failed to chmod ${tool} with code ${ret}!"
exit 1
fi
done

# Done with tools
cd .. || exit 1

# Refresh PATH to apply overrides
export PATH="${COVERITY_TOOLS_DIR}:${PATH}"

0 comments on commit b35c5bf

Please sign in to comment.