mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
style(nproc): reformat with rustfmt
This commit is contained in:
parent
b7b347ff03
commit
7b452f3bfe
2 changed files with 11 additions and 14 deletions
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
|
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
|
||||||
|
|
||||||
|
extern crate clap;
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate num_cpus;
|
extern crate num_cpus;
|
||||||
extern crate clap;
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -17,8 +17,8 @@ extern crate libc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate uucore;
|
extern crate uucore;
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
|
use std::env;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
|
pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
|
||||||
|
@ -71,7 +71,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
None => 0,
|
None => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if ! matches.is_present(OPT_ALL) {
|
if !matches.is_present(OPT_ALL) {
|
||||||
// OMP_NUM_THREADS doesn't have an impact on --all
|
// OMP_NUM_THREADS doesn't have an impact on --all
|
||||||
ignore += match env::var("OMP_NUM_THREADS") {
|
ignore += match env::var("OMP_NUM_THREADS") {
|
||||||
Ok(threadstr) => match threadstr.parse() {
|
Ok(threadstr) => match threadstr.parse() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ fn test_nproc() {
|
||||||
assert!(nproc > 0);
|
assert!(nproc > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_nproc_all_omp() {
|
fn test_nproc_all_omp() {
|
||||||
let (_, mut ucmd) = at_and_ucmd!();
|
let (_, mut ucmd) = at_and_ucmd!();
|
||||||
|
@ -18,15 +17,13 @@ fn test_nproc_all_omp() {
|
||||||
let nproc: u8 = result.stdout.trim().parse().unwrap();
|
let nproc: u8 = result.stdout.trim().parse().unwrap();
|
||||||
assert!(nproc > 0);
|
assert!(nproc > 0);
|
||||||
|
|
||||||
|
|
||||||
let result = TestScenario::new(util_name!())
|
let result = TestScenario::new(util_name!())
|
||||||
.ucmd_keepenv()
|
.ucmd_keepenv()
|
||||||
.env("OMP_NUM_THREADS", "1")
|
.env("OMP_NUM_THREADS", "1")
|
||||||
.run();
|
.run();
|
||||||
assert!(result.success);
|
assert!(result.success);
|
||||||
let nproc_omp: u8 = result.stdout.trim().parse().unwrap();
|
let nproc_omp: u8 = result.stdout.trim().parse().unwrap();
|
||||||
assert!(nproc-1 == nproc_omp);
|
assert!(nproc - 1 == nproc_omp);
|
||||||
|
|
||||||
|
|
||||||
let result = TestScenario::new(util_name!())
|
let result = TestScenario::new(util_name!())
|
||||||
.ucmd_keepenv()
|
.ucmd_keepenv()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue