@@ -943,20 +943,12 @@ mod tests {
943
943
}
944
944
945
945
#[ test]
946
- #[ cfg( not( target_os="android" ) ) ]
947
946
fn test_process_status( ) {
948
947
assert_eq!( run:: process_status( "false" , [ ] ) , 1 ) ;
949
948
assert_eq!( run:: process_status( "true" , [ ] ) , 0 ) ;
950
949
}
951
- #[ test]
952
- #[ cfg( target_os="android" ) ]
953
- fn test_process_status( ) {
954
- assert_eq!( run:: process_status( "/system/bin/sh" , [ ~"-c",~" false "]), 1);
955
- assert_eq!(run::process_status(" /system/bin/sh", [~" -c",~" true "]), 0);
956
- }
957
950
958
951
#[ test]
959
- #[cfg(not(target_os=" android"))]
960
952
fn test_process_output_output( ) {
961
953
962
954
let run:: ProcessOutput { status, output, error}
@@ -970,24 +962,8 @@ mod tests {
970
962
assert_eq!(error, ~[]);
971
963
}
972
964
}
973
- #[test]
974
- #[cfg(target_os=" android")]
975
- fn test_process_output_output() {
976
-
977
- let run::ProcessOutput {status, output, error}
978
- = run::process_output(" /system/bin/sh", [~" -c",~" echo hello"]);
979
- let output_str = str::from_bytes(output);
980
-
981
- assert_eq!(status, 0);
982
- assert_eq!(output_str.trim().to_owned(), ~" hello");
983
- // FIXME #7224
984
- if !running_on_valgrind() {
985
- assert_eq!(error, ~[]);
986
- }
987
- }
988
965
989
966
#[test]
990
- #[cfg(not(target_os=" android"))]
991
967
fn test_process_output_error() {
992
968
993
969
let run::ProcessOutput {status, output, error}
@@ -997,17 +973,6 @@ mod tests {
997
973
assert_eq!(output, ~[]);
998
974
assert!(!error.is_empty());
999
975
}
1000
- #[test]
1001
- #[cfg(target_os=" android")]
1002
- fn test_process_output_error() {
1003
-
1004
- let run::ProcessOutput {status, output, error}
1005
- = run::process_output(" /system/bin/mkdir", [~" . "]);
1006
-
1007
- assert_eq!(status, 255);
1008
- assert_eq!(output, ~[]);
1009
- assert!(!error.is_empty());
1010
- }
1011
976
1012
977
#[test]
1013
978
fn test_pipes() {
@@ -1058,37 +1023,19 @@ mod tests {
1058
1023
}
1059
1024
1060
1025
#[test]
1061
- #[cfg(not(target_os=" android"))]
1062
1026
fn test_finish_once() {
1063
1027
let mut prog = run::Process::new(" false ", [], run::ProcessOptions::new());
1064
1028
assert_eq!(prog.finish(), 1);
1065
1029
}
1066
- #[test]
1067
- #[cfg(target_os=" android")]
1068
- fn test_finish_once() {
1069
- let mut prog = run::Process::new(" /system/bin/sh", [~" -c",~" false "],
1070
- run::ProcessOptions::new());
1071
- assert_eq!(prog.finish(), 1);
1072
- }
1073
1030
1074
1031
#[test]
1075
- #[cfg(not(target_os=" android"))]
1076
1032
fn test_finish_twice() {
1077
1033
let mut prog = run::Process::new(" false ", [], run::ProcessOptions::new());
1078
1034
assert_eq!(prog.finish(), 1);
1079
1035
assert_eq!(prog.finish(), 1);
1080
1036
}
1081
- #[test]
1082
- #[cfg(target_os=" android")]
1083
- fn test_finish_twice() {
1084
- let mut prog = run::Process::new(" /system/bin/sh", [~" -c",~" false "],
1085
- run::ProcessOptions::new());
1086
- assert_eq!(prog.finish(), 1);
1087
- assert_eq!(prog.finish(), 1);
1088
- }
1089
1037
1090
1038
#[test]
1091
- #[cfg(not(target_os=" android"))]
1092
1039
fn test_finish_with_output_once() {
1093
1040
1094
1041
let mut prog = run::Process::new(" echo", [~" hello"], run::ProcessOptions::new());
@@ -1103,26 +1050,8 @@ mod tests {
1103
1050
assert_eq!(error, ~[]);
1104
1051
}
1105
1052
}
1106
- #[test]
1107
- #[cfg(target_os=" android")]
1108
- fn test_finish_with_output_once() {
1109
-
1110
- let mut prog = run::Process::new(" /system/bin/sh", [~" -c",~" echo hello"],
1111
- run::ProcessOptions::new());
1112
- let run::ProcessOutput {status, output, error}
1113
- = prog.finish_with_output();
1114
- let output_str = str::from_bytes(output);
1115
-
1116
- assert_eq!(status, 0);
1117
- assert_eq!(output_str.trim().to_owned(), ~" hello");
1118
- // FIXME #7224
1119
- if !running_on_valgrind() {
1120
- assert_eq!(error, ~[]);
1121
- }
1122
- }
1123
1053
1124
1054
#[test]
1125
- #[cfg(not(target_os=" android"))]
1126
1055
fn test_finish_with_output_twice() {
1127
1056
1128
1057
let mut prog = run::Process::new(" echo", [~" hello"], run::ProcessOptions::new());
@@ -1148,38 +1077,10 @@ mod tests {
1148
1077
assert_eq!(error, ~[]);
1149
1078
}
1150
1079
}
1151
- #[test]
1152
- #[cfg(target_os=" android")]
1153
- fn test_finish_with_output_twice() {
1154
-
1155
- let mut prog = run::Process::new(" /system/bin/sh", [~" -c",~" echo hello"],
1156
- run::ProcessOptions::new());
1157
- let run::ProcessOutput {status, output, error}
1158
- = prog.finish_with_output();
1159
-
1160
- let output_str = str::from_bytes(output);
1161
-
1162
- assert_eq!(status, 0);
1163
- assert_eq!(output_str.trim().to_owned(), ~" hello");
1164
- // FIXME #7224
1165
- if !running_on_valgrind() {
1166
- assert_eq!(error, ~[]);
1167
- }
1168
-
1169
- let run::ProcessOutput {status, output, error}
1170
- = prog.finish_with_output();
1171
-
1172
- assert_eq!(status, 0);
1173
- assert_eq!(output, ~[]);
1174
- // FIXME #7224
1175
- if !running_on_valgrind() {
1176
- assert_eq!(error, ~[]);
1177
- }
1178
- }
1179
1080
1180
1081
#[test]
1181
1082
#[should_fail]
1182
- #[cfg(not(windows),not(target_os=" android ") )]
1083
+ #[cfg(not(windows))]
1183
1084
fn test_finish_with_output_redirected() {
1184
1085
let mut prog = run::Process::new(" echo", [~" hello"], run::ProcessOptions {
1185
1086
env: None,
@@ -1191,36 +1092,14 @@ mod tests {
1191
1092
// this should fail because it is not valid to read the output when it was redirected
1192
1093
prog.finish_with_output();
1193
1094
}
1194
- #[test]
1195
- #[should_fail]
1196
- #[cfg(not(windows),target_os=" android")]
1197
- fn test_finish_with_output_redirected() {
1198
- let mut prog = run::Process::new(" /system/bin/sh", [~" -c",~" echo hello"],
1199
- run::ProcessOptions {
1200
- env: None,
1201
- dir: None,
1202
- in_fd: Some(0),
1203
- out_fd: Some(1),
1204
- err_fd: Some(2)
1205
- });
1206
- // this should fail because it is not valid to read the output when it was redirected
1207
- prog.finish_with_output();
1208
- }
1209
1095
1210
- #[cfg(unix,not(target_os=" android ") )]
1096
+ #[cfg(unix)]
1211
1097
fn run_pwd(dir: Option<&Path>) -> run::Process {
1212
1098
run::Process::new(" pwd", [], run::ProcessOptions {
1213
1099
dir: dir,
1214
1100
.. run::ProcessOptions::new()
1215
1101
})
1216
1102
}
1217
- #[cfg(unix,target_os=" android")]
1218
- fn run_pwd(dir: Option<&Path>) -> run::Process {
1219
- run::Process::new(" /system/bin/sh", [~" -c",~" pwd"], run::ProcessOptions {
1220
- dir: dir,
1221
- .. run::ProcessOptions::new()
1222
- })
1223
- }
1224
1103
1225
1104
#[cfg(windows)]
1226
1105
fn run_pwd(dir: Option<&Path>) -> run::Process {
@@ -1262,20 +1141,13 @@ mod tests {
1262
1141
assert_eq!(parent_stat.st_ino, child_stat.st_ino);
1263
1142
}
1264
1143
1265
- #[cfg(unix,not(target_os=" android ") )]
1144
+ #[cfg(unix)]
1266
1145
fn run_env(env: Option<&[(~str, ~str)]>) -> run::Process {
1267
1146
run::Process::new(" env", [], run::ProcessOptions {
1268
1147
env: env,
1269
1148
.. run::ProcessOptions::new()
1270
1149
})
1271
1150
}
1272
- #[cfg(unix,target_os=" android")]
1273
- fn run_env(env: Option<&[(~str, ~str)]>) -> run::Process {
1274
- run::Process::new(" /system/bin/sh", [~" -c",~" set"], run::ProcessOptions {
1275
- env: env,
1276
- .. run::ProcessOptions::new()
1277
- })
1278
- }
1279
1151
1280
1152
#[cfg(windows)]
1281
1153
fn run_env(env: Option<&[(~str, ~str)]>) -> run::Process {
@@ -1286,7 +1158,6 @@ mod tests {
1286
1158
}
1287
1159
1288
1160
#[test]
1289
- #[cfg(not(target_os=" android"))]
1290
1161
fn test_inherit_env() {
1291
1162
if running_on_valgrind() { return; }
1292
1163
@@ -1299,23 +1170,6 @@ mod tests {
1299
1170
assert!(k.is_empty() || output.contains(fmt!(" %s=%s", k, v)));
1300
1171
}
1301
1172
}
1302
- #[test]
1303
- #[cfg(target_os=" android")]
1304
- fn test_inherit_env() {
1305
- if running_on_valgrind() { return; }
1306
-
1307
- let mut prog = run_env(None);
1308
- let output = str::from_bytes(prog.finish_with_output().output);
1309
-
1310
- let r = os::env();
1311
- for r.iter().advance |&(k, v)| {
1312
- // don't check android RANDOM variables
1313
- if k != ~" RANDOM " {
1314
- assert!(output.contains(fmt!(" %s=%s", k, v)) ||
1315
- output.contains(fmt!(" %s=\' %s\' ", k, v) ) ) ;
1316
- }
1317
- }
1318
- }
1319
1173
1320
1174
#[test]
1321
1175
fn test_add_to_env() {
0 commit comments