Skip to content
Draft
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
2 changes: 1 addition & 1 deletion src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ ENDFOREACH(T)
# toolchain: requires elan to download toolchain
# online: downloads remote repositories
file(GLOB_RECURSE LEANLAKETESTS
#"${LEAN_SOURCE_DIR}/../tests/lake/tests/test.sh"
"${LEAN_SOURCE_DIR}/../tests/lake/tests/test.sh"
"${LEAN_SOURCE_DIR}/../tests/lake/examples/test.sh")
FOREACH(T ${LEANLAKETESTS})
if(NOT T MATCHES ".*(lake-packages|bootstrap|toolchain|online).*")
Expand Down
18 changes: 15 additions & 3 deletions tests/lake/tests/cache/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ test_exp -f "$cache_art" # artifact should be re-cached

# Verify that upstream cache mappings are restored
test_out "Replayed Test:c.o" build Test:static -v --no-build
check_diff <(ls .lake/backup-outputs) <(ls "$CACHE_DIR/outputs")
ls .lake/backup-outputs > .lake/backup-outputs.txt
check_diff .lake/backup-outputs.txt <(ls "$CACHE_DIR/outputs")

# Verify that things work properly if the local artifact is removed
test_cmd rm "$local_art"
Expand All @@ -150,11 +151,22 @@ test_run -v build +Test.Imported --no-build --wfail
test_run -v build +Test

# Test producing an output mappings file
test_lines() {
expected=$1; file=$2
actual=$(wc -l < $file)
echo "? wc -l $file ($actual) = $expected"
if test $actual = $expected; then
return 0
else
cat "$file"
return 1
fi
}
test_run build Test -o .lake/outputs.jsonl
test_exp -f .lake/outputs.jsonl
test_cmd_eq 3 wc -l < .lake/outputs.jsonl
test_lines 3 .lake/outputs.jsonl
test_run build Test:static -o .lake/outputs.jsonl
test_cmd_eq 6 wc -l < .lake/outputs.jsonl
test_lines 6 .lake/outputs.jsonl

# Verify all artifacts end up in the cache directory with `restoreAllArtifacts`
test_cmd cp -r "$CACHE_DIR" .lake/cache-backup
Expand Down
18 changes: 9 additions & 9 deletions tests/lake/tests/module/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ test_run build Test.CrossPackageImportAll
# Tests importing of a module's private segment
# should not not be imported by a plain `import` in a module
test_run build Test.Module.Import
test_cmd_fails grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/Import.setup.json
test_cmd_fails grep -F "TModule.olean.private" .lake/build/ir/Test/Module/Import.setup.json
test_run build Test.Module.PublicImport
test_cmd_fails grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/PublicImport.setup.json
test_cmd_fails grep -F "Module.olean.private" .lake/build/ir/Test/Module/PublicImport.setup.json
# should be imported by an `import all` in a module
test_run build Test.Module.ImportAll
test_cmd grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/ImportAll.setup.json
test_cmd grep -F "Module.olean.private" .lake/build/ir/Test/Module/ImportAll.setup.json
# including promoted imports
test_run build Test.Module.PromoteImport
test_cmd grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/PromoteImport.setup.json
test_cmd grep -F "Module.olean.private" .lake/build/ir/Test/Module/PromoteImport.setup.json
test_run build Test.Module.PromoteTransImport
test_cmd grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/PromoteTransImport.setup.json
test_cmd grep -F "Module.olean.private" .lake/build/ir/Test/Module/PromoteTransImport.setup.json
# should be imported by a non-module
test_run build Test.NonModule.Import
test_cmd grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/NonModule/Import.setup.json
test_cmd grep -F "Module.olean.private" .lake/build/ir/Test/NonModule/Import.setup.json
# should not be imported by a module transitive import of a private `import all`
test_run build Test.Module.ImportImportAll
test_cmd_fails grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/ImportImportAll.setup.json
test_cmd_fails grep -F "Module.olean.private" .lake/build/ir/Test/Module/ImportImportAll.setup.json
# should not be imported by an `import all` of a private module `import`
test_run build Test.Module.ImportAllImport
test_cmd_fails grep -F "Test/Generated/Module.olean.private" .lake/build/ir/Test/Module/ImportAllImport.setup.json
test_cmd_fails grep -F "Module.olean.private" .lake/build/ir/Test/Module/ImportAllImport.setup.json

# Tests that the transitive module import of a private import does not include its artifacts
test_run build Test.Module.ImportImport
test_cmd_fails grep -F "Test/Generated/Module.olean" .lake/build/ir/Test/Module/ImportImport.setup.json
test_cmd_fails grep -F "Module.olean" .lake/build/ir/Test/Module/ImportImport.setup.json

# Build all tests before making an edit
test_run build
Expand Down