remote_executor.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "testrunnerlite.h"
#include "executor.h"
#include "testdefinitionprocessor.h"
#include "remote_executor.h"
#include "log.h"

Go to the source code of this file.

Defines

#define SSHCMD   "/usr/bin/ssh"
#define SSHCMDARGS
#define SSHCMDARGS_STR
#define UNIQUE_ID_FMT   "%d"
#define PID_FILE_FMT   "/var/tmp/testrunner-lite-%s.%d.pid"
#define UNIQUE_ID_MAX_LEN   (HOST_NAME_MAX + 10 + 1 + 1)
#define PID_FILE_MAX_LEN   (30 + UNIQUE_ID_MAX_LEN + 10 + 1 + 1)

Functions

void ssh_executor_init (const char *hostname)
int ssh_execute (const char *hostname, const char *command)
int ssh_check_conn (const char *hostname)
int ssh_kill (const char *hostname, pid_t id)
void ssh_clean (const char *hostname, pid_t id)
void ssh_executor_close (const char *hostname)

Variables

LOCAL char * unique_id = NULL


Define Documentation

#define PID_FILE_FMT   "/var/tmp/testrunner-lite-%s.%d.pid"

Definition at line 74 of file remote_executor.c.

#define PID_FILE_MAX_LEN   (30 + UNIQUE_ID_MAX_LEN + 10 + 1 + 1)

Definition at line 76 of file remote_executor.c.

#define SSHCMD   "/usr/bin/ssh"

Definition at line 63 of file remote_executor.c.

#define SSHCMDARGS

Value:

"-o StrictHostKeyChecking=no",\
                    "-o PasswordAuthentication=no"

Definition at line 64 of file remote_executor.c.

#define SSHCMDARGS_STR

Value:

"-o StrictHostKeyChecking=no " \
                        "-o PasswordAuthentication=no"

Definition at line 66 of file remote_executor.c.

#define UNIQUE_ID_FMT   "%d"

Definition at line 73 of file remote_executor.c.

#define UNIQUE_ID_MAX_LEN   (HOST_NAME_MAX + 10 + 1 + 1)

Definition at line 75 of file remote_executor.c.


Function Documentation

int ssh_check_conn ( const char *  hostname  ) 

Tries to check if ssh connections are still working

Parameters:
hostname SUT address
Returns:
0 or ssh error code

Definition at line 178 of file remote_executor.c.

void ssh_clean ( const char *  hostname,
pid_t  id 
)

Clean temporary file from target machine

Parameters:
hostname SUT address
id PID of the test step

Definition at line 222 of file remote_executor.c.

int ssh_execute ( const char *  hostname,
const char *  command 
)

Executes a command using ssh

Parameters:
hostname SUT address
command Command to execute
Returns:
Does not return in success, error code from exec in case of error

Definition at line 133 of file remote_executor.c.

void ssh_executor_close ( const char *  hostname  ) 

Clean up

Parameters:
hostname SUT address

Definition at line 247 of file remote_executor.c.

void ssh_executor_init ( const char *  hostname  ) 

Init the ssh executor

Definition at line 97 of file remote_executor.c.

int ssh_kill ( const char *  hostname,
pid_t  id 
)

Tries to kill program started by ssh and removes temporary file

Parameters:
hostname SUT address
id PID of the test step

Definition at line 192 of file remote_executor.c.


Variable Documentation

LOCAL char* unique_id = NULL

Definition at line 70 of file remote_executor.c.


Generated on Tue Jul 27 01:28:56 2010 for testrunner-lite by  doxygen 1.5.6