@@ -4,6 +4,7 @@ use clap::Parser;
4
4
use colored:: Colorize ;
5
5
use once_cell:: sync:: Lazy ;
6
6
use serde:: { Deserialize , Serialize } ;
7
+ use tempdir:: TempDir ;
7
8
8
9
use crate :: { library:: Args , run_commands:: prlimit_run_command} ;
9
10
@@ -97,7 +98,7 @@ pub(crate) type ICEDisplay = String;
97
98
98
99
impl ICE {
99
100
// print a ICE to stdout or something
100
- pub ( crate ) fn to_printable ( & self ) -> ICEDisplay {
101
+ pub ( crate ) fn to_printable ( & self , global_tempdir : & PathBuf ) -> ICEDisplay {
101
102
let kind = match self . kind {
102
103
ICEKind :: Ice ( Interestingness :: Interesting ) => "ICE" . red ( ) ,
103
104
ICEKind :: Ice ( Interestingness :: Boring ) => "ice" . normal ( ) ,
@@ -115,7 +116,7 @@ impl ICE {
115
116
116
117
// HACK
117
118
// also log the ICE to disk here since its probably most convenient at this place in time/code
118
- let report: Report = self . into ( ) ;
119
+ let report: Report = self . clone ( ) . into_report ( global_tempdir ) ;
119
120
report. to_disk ( ) ;
120
121
121
122
format ! (
@@ -131,7 +132,7 @@ impl ICE {
131
132
/*
132
133
fn _run_treereduce(ice: &ICE) {
133
134
let file = ice.file;
134
- let original_code = std::fs::read_to_string (&original_path).unwrap_or("<error>".into());
135
+ let original_code = std::fs::read_to_strinaggregateg (&original_path).unwrap_or("<error>".into());
135
136
let flags = self.args.clone().join(" ");
136
137
let executable_bin = &self.executable.path();
137
138
let prl_output = prlimit_run_command(&mut cmd).expect("prlimit process failed");
@@ -143,9 +144,13 @@ pub(crate) struct Report {
143
144
data : String ,
144
145
}
145
146
146
- impl From < & ICE > for Report {
147
- fn from ( ice : & ICE ) -> Self {
147
+ impl ICE {
148
+ fn into_report ( self , global_tempdir_path : & PathBuf ) -> Report {
149
+ let ice = & self ;
148
150
//unreachable!("DO USE TMPDIR HERE!");
151
+ let tempdir =
152
+ TempDir :: new_in ( global_tempdir_path, "rustc_testrunner_tmpdir_reporting" ) . unwrap ( ) ;
153
+ let tempdir_path = tempdir. path ( ) . display ( ) ;
149
154
150
155
let original_path = ice. file . clone ( ) ;
151
156
let original_path_display = original_path. display ( ) ;
@@ -157,6 +162,7 @@ impl From<&ICE> for Report {
157
162
let mut cmd = std:: process:: Command :: new ( executable_bin) ;
158
163
cmd. args ( & ice. args ) ;
159
164
cmd. arg ( & ice. file ) ;
165
+ cmd. current_dir ( tempdir_path. to_string ( ) ) ;
160
166
161
167
let prl_output = prlimit_run_command ( & mut cmd) . expect ( "prlimit process failed" ) ;
162
168
// let output_stderr = String::from_utf8(prl_output.stdout).unwrap();
0 commit comments