45#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
59 astring DEFAULT_SOURCE_DIRECTORY;
60 astring DEFAULT_TARGET_DIRECTORY;
63void test_file_transfer_tentacle::print_instructions()
67This program needs two parameters:\n\
68a directory for the source root and one for the target root.\n\
69Optionally, a third parameter may specify a starting point within the\n\
71Further, if fourth or more parameters are found, they are taken to be\n\
72files to include; only they will be transferred.\n");
76int test_file_transfer_tentacle::execute()
87 if (source_dir.
empty()) {
88 LOG(
astring(
"using default source directory: ") + DEFAULT_SOURCE_DIRECTORY);
89 source_dir = DEFAULT_SOURCE_DIRECTORY;
93 if (target_dir.
empty()) {
94 LOG(
astring(
"using default target directory: ") + DEFAULT_TARGET_DIRECTORY);
95 target_dir = DEFAULT_TARGET_DIRECTORY;
98 deadly_error(class_name(), func,
astring(
"failed to create target directory for copying: ") + target_dir);
104 if (!source.exists() || !source.is_directory()) {
109 if (!target.exists() || !target.is_directory()) {
128 target_dir, includes, source_start);
133 if (returned == common::OKAY) {
142 if (rm_result != 0) {
145 returned = common::ACCESS_DENIED;
148 if (returned == common::OKAY)
150 "functions tested.");
int print_instructions(bool good, const astring &program_name)
The application_shell is a base object for console programs.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
application_shell()
constructs an application_shell to serve as the root of the program.
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
bool empty() const
empty() reports if the string is empty, that is, of zero length().
static astring get(const astring &variable_name)
looks up the "variable_name" in the current environment variables.
Outcomes describe the state of completion for an operation.
static bool make_directory(const basis::astring &path)
returns true if the directory "path" could be created.
Provides operations commonly needed on file names.
static void alert_message(const char *info, const char *title="Alert Message")
shows the message in "info", with an optional "title" on the message.
@ COMPARE_SIZE_AND_TIME
uses size and time to see differences.
static const char * outcome_name(const basis::outcome &to_name)
static basis::outcome copy_hierarchy(int transfer_mode, const basis::astring &source_dir, const basis::astring &target_dir, const structures::string_array &includes, const basis::astring &source_start=basis::astring::empty_string())
copies a directory hierarchy starting at "source_dir" into "target_dir".
Provides the capability to start processes in a variety of ways to run other applications.
@ AWAIT_APP_EXIT
stays in the function until the launched application has exited.
static basis::un_int run(const basis::astring &app_name, const basis::astring &command_line, int flag, basis::un_int &child_id)
starts an application using the "app_name" as the executable to run.
An array of strings with some additional helpful methods.
#define deadly_error(c, f, i)
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
unsigned int un_int
Abbreviated name for unsigned integers.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.