From 834ec68821b0d911d1ba095518bc7763236216dc Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 26 May 2021 17:44:03 -0700 Subject: [PATCH] Add test to check behavior when incremental session init fails. --- .../run-make/incremental-session-fail/Makefile | 15 +++++++++++++++ src/test/run-make/incremental-session-fail/foo.rs | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/test/run-make/incremental-session-fail/Makefile create mode 100644 src/test/run-make/incremental-session-fail/foo.rs diff --git a/src/test/run-make/incremental-session-fail/Makefile b/src/test/run-make/incremental-session-fail/Makefile new file mode 100644 index 00000000000..208a1b13a6d --- /dev/null +++ b/src/test/run-make/incremental-session-fail/Makefile @@ -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) diff --git a/src/test/run-make/incremental-session-fail/foo.rs b/src/test/run-make/incremental-session-fail/foo.rs new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/src/test/run-make/incremental-session-fail/foo.rs @@ -0,0 +1 @@ +// intentionally empty