File tree 2 files changed +26
-20
lines changed
tests/run-make/rustdoc-io-error
2 files changed +26
-20
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // This test verifies that rustdoc doesn't ICE when it encounters an IO error
2
+ // while generating files. Ideally this would be a rustdoc-ui test, so we could
3
+ // verify the error message as well.
4
+ //
5
+ // It operates by creating a temporary directory and modifying its
6
+ // permissions so that it is not writable. We have to take special care to set
7
+ // the permissions back to normal so that it's able to be deleted later.
8
+
9
+ use run_make_support:: { rustdoc, tmp_dir} ;
10
+ use std:: fs;
11
+
12
+ fn main ( ) {
13
+ let out_dir = tmp_dir ( ) . join ( "rustdoc-io-error" ) ;
14
+ let output = fs:: create_dir ( & out_dir) . unwrap ( ) ;
15
+ let mut permissions = fs:: metadata ( & out_dir) . unwrap ( ) . permissions ( ) ;
16
+ permissions. set_readonly ( true ) ;
17
+ fs:: set_permissions ( & out_dir, permissions) . unwrap ( ) ;
18
+
19
+ let output = rustdoc ( ) . input ( "foo.rs" ) . output ( & out_dir) . command_output ( ) ;
20
+ #[ cfg( not( windows) ) ]
21
+ assert_eq ! ( output. status. code( ) . unwrap( ) , 1 ) ;
22
+ assert ! ( !output. status. success( ) ) ;
23
+ let stderr = String :: from_utf8 ( output. stderr ) . unwrap ( ) ;
24
+
25
+ assert ! ( stderr. contains( "error: couldn't generate documentation: Permission denied" ) ) ;
26
+ }
You can’t perform that action at this time.
0 commit comments