Skip to content

Commit

Permalink
Add test to check behavior when incremental session init fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed May 27, 2021
1 parent 074d667 commit 834ec68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/run-make/incremental-session-fail/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include ../../run-make-fulldeps/tools.mk

SESSION_DIR := $(TMPDIR)/session
OUTPUT_FILE := $(TMPDIR)/build-output

all:
echo $(TMPDIR)
mkdir $(SESSION_DIR)
# Make it so that rustc will fail to create a session directory.
chmod a-w $(SESSION_DIR)
# Check exit code is 1 for an error, and not 101 for ICE.
$(RUSTC) foo.rs --crate-type=rlib -C incremental=$(SESSION_DIR) > $(OUTPUT_FILE) 2>&1; [ $$? -eq 1 ]
$(CGREP) "Could not create incremental compilation crate directory" < $(OUTPUT_FILE)
# -v tests are fragile, hopefully this text won't change
$(CGREP) -v "internal compiler error" < $(OUTPUT_FILE)
1 change: 1 addition & 0 deletions src/test/run-make/incremental-session-fail/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// intentionally empty

0 comments on commit 834ec68

Please sign in to comment.