File tree Expand file tree Collapse file tree
cloud-hypervisor/tests/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,41 +255,6 @@ pub(crate) fn prepare_swtpm_daemon(tmp_dir: &TempDir) -> (std::process::Command,
255255 ( swtpm_command, swtpm_socket_path)
256256}
257257
258- pub ( crate ) fn remote_command ( api_socket : & str , command : & str , arg : Option < & str > ) -> bool {
259- let mut cmd = Command :: new ( clh_command ( "ch-remote" ) ) ;
260- cmd. args ( [ & format ! ( "--api-socket={api_socket}" ) , command] ) ;
261-
262- if let Some ( arg) = arg {
263- cmd. arg ( arg) ;
264- }
265- let output = cmd. output ( ) . unwrap ( ) ;
266- if output. status . success ( ) {
267- true
268- } else {
269- eprintln ! ( "Error running ch-remote command: {:?}" , & cmd) ;
270- let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
271- eprintln ! ( "stderr: {stderr}" ) ;
272- false
273- }
274- }
275-
276- pub ( crate ) fn remote_command_w_output (
277- api_socket : & str ,
278- command : & str ,
279- arg : Option < & str > ,
280- ) -> ( bool , Vec < u8 > ) {
281- let mut cmd = Command :: new ( clh_command ( "ch-remote" ) ) ;
282- cmd. args ( [ & format ! ( "--api-socket={api_socket}" ) , command] ) ;
283-
284- if let Some ( arg) = arg {
285- cmd. arg ( arg) ;
286- }
287-
288- let output = cmd. output ( ) . expect ( "Failed to launch ch-remote" ) ;
289-
290- ( output. status . success ( ) , output. stdout )
291- }
292-
293258pub ( crate ) fn resize_command (
294259 api_socket : & str ,
295260 desired_vcpus : Option < u8 > ,
Original file line number Diff line number Diff line change @@ -1776,6 +1776,42 @@ pub fn clh_command(cmd: &str) -> String {
17761776 String :: from ( full_path. to_str ( ) . unwrap ( ) )
17771777}
17781778
1779+ pub fn remote_command ( api_socket : & str , command : & str , arg : Option < & str > ) -> bool {
1780+ let mut cmd = Command :: new ( clh_command ( "ch-remote" ) ) ;
1781+ cmd. args ( [ & format ! ( "--api-socket={api_socket}" ) , command] ) ;
1782+
1783+ if let Some ( arg) = arg {
1784+ cmd. arg ( arg) ;
1785+ }
1786+
1787+ let output = cmd. output ( ) . unwrap ( ) ;
1788+ if output. status . success ( ) {
1789+ true
1790+ } else {
1791+ eprintln ! ( "Error running ch-remote command: {:?}" , & cmd) ;
1792+ let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
1793+ eprintln ! ( "stderr: {stderr}" ) ;
1794+ false
1795+ }
1796+ }
1797+
1798+ pub fn remote_command_w_output (
1799+ api_socket : & str ,
1800+ command : & str ,
1801+ arg : Option < & str > ,
1802+ ) -> ( bool , Vec < u8 > ) {
1803+ let mut cmd = Command :: new ( clh_command ( "ch-remote" ) ) ;
1804+ cmd. args ( [ & format ! ( "--api-socket={api_socket}" ) , command] ) ;
1805+
1806+ if let Some ( arg) = arg {
1807+ cmd. arg ( arg) ;
1808+ }
1809+
1810+ let output = cmd. output ( ) . expect ( "Failed to launch ch-remote" ) ;
1811+
1812+ ( output. status . success ( ) , output. stdout )
1813+ }
1814+
17791815pub fn parse_iperf3_output ( output : & [ u8 ] , sender : bool , bandwidth : bool ) -> Result < f64 , Error > {
17801816 std:: panic:: catch_unwind ( || {
17811817 let s = String :: from_utf8_lossy ( output) ;
You can’t perform that action at this time.
0 commit comments