Skip to content

Commit a9fd35e

Browse files
committed
Remove test_threads()
Can't currently test `r_task()` because it requires a functioning `R_MAIN`
1 parent fc087d6 commit a9fd35e

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

crates/harp/src/exec.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -457,17 +457,11 @@ where
457457

458458
#[cfg(test)]
459459
mod tests {
460-
461460
use std::ffi::CString;
462-
use std::io::Write;
463-
464-
use stdext::spawn;
465461

466462
use super::*;
467463
use crate::assert_match;
468-
use crate::r_lock;
469464
use crate::r_test;
470-
use crate::r_test_unlocked;
471465
use crate::utils::r_envir_remove;
472466
use crate::utils::r_is_null;
473467

@@ -528,44 +522,6 @@ mod tests {
528522
}
529523
}
530524

531-
#[test]
532-
fn test_threads() {
533-
// TODO: Switch to `r_task()`
534-
r_test_unlocked! {
535-
536-
// Spawn a bunch of threads that try to interact with R.
537-
const N : i32 = 1000;
538-
let mut handles : Vec<_> = Vec::new();
539-
for i in 1..20 {
540-
let handle = spawn!(format!("test_exec_test_threads_{}", i), move || {
541-
let id = std::thread::current().id();
542-
for _j in 1..20 {
543-
r_lock! {
544-
println!("Thread {:?} acquiring R lock.", id);
545-
std::io::stdout().flush().unwrap();
546-
let mut protect = RProtect::new();
547-
let code = protect.add(Rf_lang2(r_symbol!("rnorm"), Rf_ScalarInteger(N)));
548-
println!("Thread {:?} about to evaluate R code.", id);
549-
std::io::stdout().flush().unwrap();
550-
let result = protect.add(Rf_eval(code, R_GlobalEnv));
551-
println!("Thread {:?} finished evaluating R code.", id);
552-
std::io::stdout().flush().unwrap();
553-
assert!(Rf_length(result) == N);
554-
println!("Thread {:?} releasing R lock.", std::thread::current().id());
555-
std::io::stdout().flush().unwrap();
556-
};
557-
}
558-
});
559-
handles.push(handle);
560-
}
561-
562-
for handle in handles {
563-
handle.join().unwrap();
564-
}
565-
566-
}
567-
}
568-
569525
#[test]
570526
fn test_try_catch_error() {
571527
r_test! {

0 commit comments

Comments
 (0)