about summary refs log tree commit diff
path: root/src/test/run-make-fulldeps
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-05 20:27:17 +0000
committerbors <bors@rust-lang.org>2018-12-05 20:27:17 +0000
commit14997d56a550f4aa99fe737593cd2758227afc56 (patch)
tree41d01a5ff23751fb7fa25b7f94280f283889fae8 /src/test/run-make-fulldeps
parentb866f7d258a2428e004039eb0f3fabd73cc9d6ae (diff)
parentc359f98c7a0cd6f2af10fb1369477b9a03b32c44 (diff)
downloadrust-14997d56a550f4aa99fe737593cd2758227afc56.tar.gz
rust-14997d56a550f4aa99fe737593cd2758227afc56.zip
Auto merge of #55933 - euclio:doc-panic, r=QuietMisdreavus
emit error when doc generation fails

Fixes #41813.

The diagnostic looks something like this:

```
error: couldn't generate documentation: No space left on device (os error 28)
  |
  = note: failed to create or modify "/path/to/crate/target/doc/src/lazycell"
```
Diffstat (limited to 'src/test/run-make-fulldeps')
-rw-r--r--src/test/run-make-fulldeps/rustdoc-io-error/Makefile25
-rw-r--r--src/test/run-make-fulldeps/rustdoc-io-error/foo.rs1
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/rustdoc-io-error/Makefile b/src/test/run-make-fulldeps/rustdoc-io-error/Makefile
new file mode 100644
index 00000000000..2055c9cbf2d
--- /dev/null
+++ b/src/test/run-make-fulldeps/rustdoc-io-error/Makefile
@@ -0,0 +1,25 @@
+-include ../tools.mk
+
+# This test verifies that rustdoc doesn't ICE when it encounters an IO error
+# while generating files. Ideally this would be a rustdoc-ui test, so we could
+# verify the error message as well.
+
+OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error"
+
+# Ignore Windows: the test uses `chmod`.
+ifndef IS_WINDOWS
+
+# This test operates by creating a temporary directory and modifying its
+# permissions so that it is not writable. We have to take special care to set
+# the permissions back to normal so that it's able to be deleted later.
+all:
+	mkdir -p $(OUTPUT_DIR)
+	chmod u-w $(OUTPUT_DIR)
+	-$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs)
+	chmod u+w $(OUTPUT_DIR)
+	exit $($(.SHELLSTATUS) -eq 1)
+
+else
+all:
+
+endif
diff --git a/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs b/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs
new file mode 100644
index 00000000000..4a835673a59
--- /dev/null
+++ b/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs
@@ -0,0 +1 @@
+pub struct Foo;