Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/lake/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*produced.*
work/
9 changes: 5 additions & 4 deletions tests/lake/tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,11 @@ check_diff() {

test_out_diff() {
expected=$1; shift
cat "$expected" > produced.expected.out
# We avoid a `.expected.out` name here so `lint.py` does not pick up these orphaned files
cat "$expected" > produced.expected
echo '$' lake "$@"
if "$LAKE" "$@" >produced.out 2>&1; then rc=$?; else rc=$?; fi
if check_diff_core produced.expected.out produced.out; then
if check_diff_core produced.expected produced.out; then
if [ $rc != 0 ]; then
echo "FAILURE: Program exited with code $rc"
return 1
Expand All @@ -272,10 +273,10 @@ test_out_diff() {

test_err_diff() {
expected=$1; shift
cat "$expected" > produced.expected.out
cat "$expected" > produced.expected
echo '$' lake "$@"
if "$LAKE" "$@" >produced.out 2>&1; then rc=$?; else rc=$?; fi
if check_diff_core produced.expected.out produced.out; then
if check_diff_core produced.expected produced.out; then
if [ $rc == 0 ]; then
echo "FAILURE: Lake unexpectedly succeeded"
return 1
Expand Down
2 changes: 1 addition & 1 deletion tests/lake/tests/manifest/clean.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rm -rf .lake foo/.lake bar/.git lake-packages lake-manifest.json produced.out
rm -rf work .lake foo/.lake bar/.git lake-packages lake-manifest.json produced.out
11 changes: 7 additions & 4 deletions tests/lake/tests/manifest/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ source ../common.sh

./clean.sh

# Copy test data to a working directory to avoid initializing a Git repository
# inside the checked-in source tree
WORK_DIR="$PWD/work"
mkdir -p "$WORK_DIR"
cp -r bar foo lakefile.lean lake-manifest-*.json "$WORK_DIR/"
cd "$WORK_DIR"

# Since committing a Git repository to a Git repository is not well-supported,
# We reinitialize the bar repository on each test. This requires updating the
# locked manifest to the new hash to ensure things work properly.
Expand Down Expand Up @@ -54,7 +61,3 @@ test_manifest v7
test_manifest v1.0.0
test_manifest v1.1.0
test_manifest v1.2.0

# cleanup
rm -rf bar/.git
rm -f produced.out
2 changes: 1 addition & 1 deletion tests/lake/tests/noRelease/clean.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rm -f produced*
rm -rf .lake lake-manifest.json dep/.lake dep/.git
rm -rf work .lake lake-manifest.json dep/.lake dep/.git
11 changes: 7 additions & 4 deletions tests/lake/tests/noRelease/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ source ../common.sh

./clean.sh

# Copy test data to a working directory to avoid initializing a Git repository
# inside the checked-in source tree
WORK_DIR="$PWD/work"
mkdir -p "$WORK_DIR"
cp -r dep lakefile.lean Test.lean "$WORK_DIR/"
cd "$WORK_DIR"

NO_BUILD_CODE=3

# ---
Expand Down Expand Up @@ -102,7 +109,3 @@ test_cmd_eq "$INIT_REV" git -C .lake/packages/dep rev-parse HEAD
test_run update
test_cmd_eq "$NEW_REV" git -C .lake/packages/dep rev-parse HEAD
test_run build dep:release

# Cleanup
rm -rf dep/.git
rm -f produced*
2 changes: 1 addition & 1 deletion tests/lake/tests/packageOverrides/clean.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rm -rf bar1/.git bar2/.lake .lake
rm -rf work bar1/.git bar2/.lake .lake
rm -f lake-manifest.json produced.out
11 changes: 7 additions & 4 deletions tests/lake/tests/packageOverrides/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ source ../common.sh

./clean.sh

# Copy test data to a working directory to avoid initializing a Git repository
# inside the checked-in source tree
WORK_DIR="$PWD/work"
mkdir -p "$WORK_DIR"
cp -r bar1 bar2 foo lakefile.lean packages.json "$WORK_DIR/"
cd "$WORK_DIR"

# Since committing a Git repository to a Git repository is not well-supported,
# We reinitialize the `bar1` repository on each test.
echo "# SETUP"
Expand Down Expand Up @@ -32,7 +39,3 @@ test_cmd cp packages.json .lake/package-overrides.json
test_run resolve-deps -R -Kfoo
test_out "bar2" exe bar
test_out "foo" exe foo

# Cleanup
rm -rf bar1/.git
rm -f produced.out
2 changes: 1 addition & 1 deletion tests/lake/tests/reservoirConfig/clean.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rm -f produced*
rm -rf .lake lake-manifest.json .git
rm -rf work .lake lake-manifest.json .git
11 changes: 7 additions & 4 deletions tests/lake/tests/reservoirConfig/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ source ../common.sh

./clean.sh

# Copy test data to a working directory to avoid initializing a Git repository
# inside the checked-in source tree
WORK_DIR="$PWD/work"
mkdir -p "$WORK_DIR"
cp -r lakefile.lean expected.json "$WORK_DIR/"
cd "$WORK_DIR"

# Since committing a Git repository to a Git repository is not well-supported,
# We reinitialize the repository on each test.
echo "# SETUP"
Expand All @@ -23,7 +30,3 @@ set +x
# Test that Lake produces the expected Reservoir configuration.
echo "# TEST"
test_out_diff expected.json reservoir-config

# Cleanup
rm -rf .git
rm -f produced*
1 change: 0 additions & 1 deletion tests/lake/tests/srcHash/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion tests/lake/tests/versionTags/clean.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rm -rf .lake lake-manifest.json .git
rm -rf work .lake lake-manifest.json .git
rm -f produced*
11 changes: 7 additions & 4 deletions tests/lake/tests/versionTags/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
source ../common.sh
source ./clean.sh

# Copy test data to a working directory to avoid initializing a Git repository
# inside the checked-in source tree
WORK_DIR="$PWD/work"
mkdir -p "$WORK_DIR"
cp -r lakefile.lean "$WORK_DIR/"
cd "$WORK_DIR"

# Since committing a Git repository to a Git repository is not well-supported,
# We reinitialize the repository on each test.
echo "# SETUP"
Expand Down Expand Up @@ -29,7 +36,3 @@ v1
v2
EOF
) version-tags

# Cleanup
rm -f produced*
rm -rf .git
Loading