Skip to content

Commit

Permalink
feat: lake: GNU/BSD OS detection in test scripts (#3180)
Browse files Browse the repository at this point in the history
fixes #3179
  • Loading branch information
digama0 authored Jan 14, 2024
1 parent 53af5ea commit 42e6214
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/lake/tests/buildArgs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -exo pipefail

LAKE=${LAKE:-../../.lake/build/bin/lake}

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/clone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -exo pipefail

LAKE=${LAKE:-../../../.lake/build/bin/lake}

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/depTree/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -exo pipefail

LAKE=${LAKE:-$PWD/../../.lake/build/bin/lake}

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down
5 changes: 3 additions & 2 deletions src/lake/tests/init/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -euxo pipefail

./clean.sh

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down Expand Up @@ -79,7 +80,7 @@ $LAKE -d 123-hello exe 123-hello

# Test creating packages with components that contain `.`s
# https://github.com/leanprover/lean4/issues/2999

# this fails on windows for unrelated reasons
if [ "$OSTYPE" != "msys" ]; then
$LAKE new «A.B».«C.D»
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/lock/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ exit 0

LAKE=${LAKE:-../../.lake/build/bin/lake}

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
TAIL=gtail
else
TAIL=tail
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/manifest/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -exo pipefail

LAKE=${LAKE:-../../.lake/build/bin/lake}

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/serve/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
TAIL=gtail
else
TAIL=tail
Expand Down
3 changes: 2 additions & 1 deletion src/lake/tests/toolchain/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if ! command -v elan > /dev/null; then
exit 0
fi

if [ "`uname`" = Darwin ]; then
unamestr=`uname`
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
sed_i() { sed -i '' "$@"; }
else
sed_i() { sed -i "$@"; }
Expand Down
2 changes: 1 addition & 1 deletion tests/ir/lirc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
if [ "$unamestr" = Darwin ] || [ "$unamestr" = FreeBSD ]; then
# OSX
if command -v greadlink >/dev/null 2>&1; then
# macOS readlink doesn't support -f option
Expand Down

0 comments on commit 42e6214

Please sign in to comment.