osquery-1/tools/audit.sh
Nick Anderson fe7b8d98f9 Adding getSystemRoot function (#2386)
Adding a cross platform function for getting the OS root
and returning it as a boost::fs::path
2016-08-18 09:32:34 -07:00

57 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/lib.sh
function check_format() {
# Create a master branch if it does not exist.
if ! git rev-parse --verify master &> /dev/null; then
git fetch origin master &> /dev/null
git branch master FETCH_HEAD &> /dev/null || true
fi
# Format and show the status
make format_master
if [[ `git diff --name-only | wc -l | awk '{print $1}'` = "0" ]]; then
return 0
else
git --no-pager diff || true
return 1
fi
}
function audit() {
log "Running various code/change audits!"
echo ""
log "Initializing and updating all submodules"
checkout_thirdparty
echo ""
log "Running: make format"
check_format
echo ""
log "Running: make check"
make check
# Check the docs creation
echo ""
log "Running: make docs"
make docs
}
audit
exit 0