"make confidence" should work on mac (partial implementation)
This commit is contained in:
3
Makefile
3
Makefile
@@ -69,7 +69,6 @@ unlock-rpm:
|
||||
confidence:
|
||||
@if [[ -e ~/.gnupg ]]; then echo ERROR: '~/.gnupg should not exist. If it does, bugs may polute your .gnupg configuration. If the code has no bugs everything will be fine. Do you feel lucky?'; false ; fi
|
||||
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; rm -rf /tmp/tmp.* ; fi
|
||||
@export PATH=~/gitwork/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin ;
|
||||
cd ~/gitwork/blackbox && tools/confidence_test.sh
|
||||
@export PATH=~/gitwork/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin ; tools/confidence_test.sh
|
||||
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; fi
|
||||
@if [[ -e ~/.gnupg ]]; then echo ERROR: '~/.gnupg was created which means the scripts might be poluting GnuPG configuration. Fix this bug.'; false ; fi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
blackbox_home=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../bin
|
||||
export PATH=${blackbox_home}:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
|
||||
export PATH="${blackbox_home}:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin"
|
||||
|
||||
. _stack_lib.sh
|
||||
|
||||
@@ -15,6 +15,25 @@ function PHASE() {
|
||||
echo '********************'
|
||||
}
|
||||
|
||||
function md5sum_file() {
|
||||
# Portably generate the MD5 hash of file $1.
|
||||
case $(uname -s) in
|
||||
Darwin )
|
||||
md5 -r "$1" | awk '{ print $1 }'
|
||||
;;
|
||||
Linux )
|
||||
md5sum "$1" | awk '{ print $1 }'
|
||||
;;
|
||||
CYGWIN* )
|
||||
md5sum "$1" | awk '{ print $1 }'
|
||||
;;
|
||||
* )
|
||||
echo 'ERROR: Unknown OS. Exiting.'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function assert_file_missing() {
|
||||
if [[ -e "$1" ]]; then
|
||||
echo "ASSERT FAILED: ${1} should not exist."
|
||||
@@ -36,7 +55,7 @@ function assert_file_md5hash() {
|
||||
local file="$1"
|
||||
local wanted="$2"
|
||||
assert_file_exists "$file"
|
||||
local found=$(md5sum <"$file" | cut -d' ' -f1 )
|
||||
local found=$(md5sum_file "$file")
|
||||
if [[ "$wanted" != "$found" ]]; then
|
||||
echo "ASSERT FAILED: $file hash wanted=$wanted found=$found"
|
||||
exit 1
|
||||
@@ -54,7 +73,7 @@ function assert_file_group() {
|
||||
;;
|
||||
esac
|
||||
|
||||
local found=$(ls -l "$file" | awk '{ print $4 }')
|
||||
local found=$(ls -lg "$file" | awk '{ print $3 }')
|
||||
# NB(tlim): We could do this with 'stat' but it would break on BSD-style OSs.
|
||||
if [[ "$wanted" != "$found" ]]; then
|
||||
echo "ASSERT FAILED: $file chgrp wanted=$wanted found=$found"
|
||||
@@ -220,6 +239,7 @@ gpg --import keyrings/live/pubring.gpg
|
||||
TEST_GID_NUM=$(id -G | fmt -1 | tail -n +2 | grep -xv $(id -u) | head -n 1)
|
||||
TEST_GID_NAME=$(getent group "$TEST_GID_NUM" | cut -d: -f1)
|
||||
DEFAULT_GID_NAME=$(getent group $(id -u) | cut -d: -f1)
|
||||
: ${DEFAULT_GID_NAME:=staff) ;
|
||||
echo TEST_GID_NUM=$TEST_GID_NUM
|
||||
echo TEST_GID_NAME=$TEST_GID_NAME
|
||||
echo DEFAULT_GID_NAME=$DEFAULT_GID_NAME
|
||||
|
||||
Reference in New Issue
Block a user