本文整理汇总了C++中ACE_Process::wait方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Process::wait方法的具体用法?C++ ACE_Process::wait怎么用?C++ ACE_Process::wait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Process
的用法示例。
在下文中一共展示了ACE_Process::wait方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: argv
// This function runs the parent process in a separate worker thread.
static ACE_THR_FUNC_RETURN
worker_parent (void *arg)
{
long handle_signals_synchronously =
reinterpret_cast <long> (arg);
ACE_Process_Options options;
ACE_TCHAR *l_argv[3];
ACE_TCHAR pid_str[100];
// Store the parent's process id so we can pass it to the child
// portably. Also, pass the test number, as well.
ACE_OS::sprintf (pid_str,
ACE_TEXT ("-p %ld -t %d"),
static_cast <long> (parent_pid),
test_number);
// We're going to create a new process that runs this program again,
// so we need to indicate that it's the child.
const ACE_TCHAR *t = ACE_TEXT (".")
ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("%sSignal_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c");
l_argv[0] = const_cast <ACE_TCHAR *> (t);
l_argv[1] = pid_str;
l_argv[2] = 0;
ACE_ARGV argv (l_argv);
// Generate a command-line!
ACE_TString exe_sub_dir;
const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR");
if (subdir_env)
{
exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env);
exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR;
}
options.command_line (argv.buf (), exe_sub_dir.c_str ());
ACE_Process pm;
child_pid = pm.spawn (options);
if (child_pid == ACE_INVALID_PID)
ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) spawning child process failed\n"), 0);
else
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) spawning child process %d\n"),
child_pid));
// Perform a <wait> until our child process has exited.
if (handle_signals_synchronously)
{
int status;
// Wait for the child process to exit.
pm.wait (&status);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) reaped child with status %d\n"),
status));
}
else
while (shut_down == 0)
{
// Wait for a signal to arrive.
if (ACE_OS::sigsuspend (0) == -1 && errno != EINTR)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("sigsuspend")));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) got signal!\n")));
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) parent worker done\n")));
return 0;
}
示例2: defined
int
run_main (int argc, ACE_TCHAR *argv[])
{
parse_args (argc, argv);
if (child_process)
{
ACE_APPEND_LOG (ACE_TEXT("Pipe_Test-children"));
ACE_Pipe a, b, c, d, e;
open_pipe (a, "a");
open_pipe (b, "b");
open_pipe (c, "c");
open_pipe (d, "d");
open_pipe (e, "e");
ACE_END_LOG;
}
else
{
ACE_START_TEST (ACE_TEXT("Pipe_Test"));
ACE_INIT_LOG (ACE_TEXT("Pipe_Test-children"));
# if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
const ACE_TCHAR *cmdline_fmt = ACE_TEXT ("%s -c%s");
# else
const ACE_TCHAR *cmdline_fmt = ACE_TEXT ("%ls -c%ls");
# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
ACE_Process_Options options;
options.command_line (cmdline_fmt,
argc > 0 ? argv[0] : ACE_TEXT ("Pipe_Test"),
close_pipe == 0 ? ACE_TEXT (" -d") : ACE_TEXT (""));
ACE_exitcode status = 0;
for (int i = 0; i < ::iterations; i++)
{
ACE_Process server;
if (server.spawn (options) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("spawn failed")),
-1);
}
else
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Server forked with pid = %d.\n"),
server.getpid ()));
}
// Wait for the process we just created to exit.
server.wait (&status);
// Check if child exited without error.
if (WIFEXITED (status) != 0
&& WEXITSTATUS (status) != 0)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Child of server %d finished with error ")
ACE_TEXT ("exit status %d\n"),
server.getpid (),
WEXITSTATUS (status)));
ACE_END_TEST;
ACE_OS::exit (WEXITSTATUS (status));
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server %d finished\n"),
server.getpid ()));
}
ACE_END_TEST;
}
return 0;
}
示例3: path
void
Obj_Module::add_source(const char *p, int imports_only)
{
ACE_Process nmproc;
ACE_Process_Options nm_opts;
ACE_CString path (p);
ACE_CString::size_type pathsep = path.rfind('/');
ACE_CString src_name;
ACE_CString workpath;
if (pathsep == ACE_CString::npos) {
src_name = path;
workpath = ".";
} else {
src_name = path.substr(pathsep+1);
workpath= path.substr(0,pathsep);
}
ACE_HANDLE pipe[2];
ACE_Pipe io(pipe);
nm_opts.working_directory (workpath.c_str());
nm_opts.set_handles (ACE_STDIN,pipe[1]);
// Options for the command line shown here are for the GNU nm 2.9.5
int result = nm_opts.command_line ("nm -C %s",src_name.c_str());
// Prevent compiler warning about "unused variable" if ACE_ASSERT is
// an empty macro.
ACE_UNUSED_ARG (result);
ACE_ASSERT (result == 0);
nmproc.spawn (nm_opts);
if (ACE_OS::close(pipe[1]) == -1)
ACE_DEBUG ((LM_DEBUG, "%p\n", "close"));
nm_opts.release_handles();
int import_lines = 0;
int export_lines = 0;
ACE_Message_Block im_buffer (102400);
ACE_Message_Block ex_buffer (102400);
ACE_Message_Block *im_buf_cur = &im_buffer;
ACE_Message_Block *ex_buf_cur = &ex_buffer;
char dummy;
int eoln = 1;
// ACE_Time_Value timeout (1,0);
int is_import = 1;
int is_export = 1;
while (eoln == 1) {
for (int i = 0; i < 10; i++) {
if (ACE_OS::read(pipe[0],&dummy,1) != 1) {
eoln = 2;
break;
}
}
if (eoln == 2)
break;
is_import = dummy == 'U';
is_export = !imports_only && (ACE_OS::strchr("BCDRTVW",dummy) != 0);
// if (ACE::recv(pipe[0],&dummy,1,&timeout) != 1)
if (ACE_OS::read(pipe[0],&dummy,1) != 1)
break;
eoln = this->read_line (pipe[0], is_import ? &im_buf_cur :
(is_export ? &ex_buf_cur : 0));
import_lines += is_import;
export_lines += is_export;
}
// ACE_DEBUG ((LM_DEBUG, "read %d import lines and %d export lines\n",
// import_lines, export_lines));
nmproc.wait ();
ACE_OS::close (pipe[0]);
this->populate_sig_list (imports_,import_lines,&im_buffer);
if (!imports_only)
this->populate_sig_list (exports_,export_lines,&ex_buffer);
}
示例4: if
int
run_parent (bool inherit_files)
{
int status = 0;
ACE_TCHAR t[] = ACE_TEXT ("ace_testXXXXXX");
// Create tempfile. This will be tested for inheritance.
ACE_TCHAR tempfile[MAXPATHLEN + 1];
if (ACE::get_temp_dir (tempfile, MAXPATHLEN - sizeof (t)) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not get temp dir\n")));
ACE_OS::strcat (tempfile, t);
ACE_HANDLE file_handle = ACE_OS::mkstemp (tempfile);
if (file_handle == ACE_INVALID_HANDLE)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not get temp filename\n")));
status = 1;
}
// Build child options
ACE_TString exe_sub_dir;
const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR");
if (subdir_env)
{
exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env);
exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR;
}
ACE_Process_Options options;
#ifndef ACE_LACKS_VA_FUNCTIONS
options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("%sProcess_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c -h %d -f %s"),
exe_sub_dir.c_str(),
(int)inherit_files,
tempfile);
#endif
options.handle_inheritance (inherit_files); /* ! */
// Spawn child
ACE_Process child;
pid_t result = child.spawn (options);
if (result == -1)
{
status = errno;
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Parent could NOT spawn child process\n")));
}
else
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Parent spawned child process with pid = %d.\n"),
child.getpid ()));
ACE_exitcode child_status;
result = child.wait (&child_status);
if (result == -1)
{
status = errno;
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could NOT wait on child process\n")));
}
else if (child_status == 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Child %d finished ok\n"),
child.getpid ()));
else
{
status = child_status;
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Child %d finished with status %d\n"),
child.getpid (), child_status));
}
return status;
}
示例5: io
void
SO_Group::add_executable (const char * path)
{
ACE_Process proc;
ACE_Process_Options opts;
ACE_HANDLE pipe[2];
ACE_Pipe io(pipe);
opts.set_handles (ACE_STDIN,pipe[1]);
int result = opts.command_line ("ldd %s",path);
// Prevent compiler warning about "unused variable" if ACE_ASSERT is
// an empty macro.
ACE_UNUSED_ARG (result);
ACE_ASSERT (result == 0);
proc.spawn (opts);
if (ACE_OS::close(pipe[1]) == -1)
ACE_DEBUG ((LM_DEBUG, "%p\n", "close"));
opts.release_handles();
const int max_line_length = 1000;
char line[max_line_length];
while (1) {
ACE_OS::memset (line,0,max_line_length);
int len = 0;
int nread = 0;
int bogus = 0;
// skip initial whitespace
while ((nread = ACE_OS::read(pipe[0],line,1)) == 1 &&
(*line == ' ' || *line == '\t'));
if (nread != 1)
break;
// read the library name
len = 1;
while ((nread = ACE_OS::read(pipe[0],line + len,1)) == 1 &&
(line[len] != ' '))
if (! bogus && ++len == max_line_length)
{
bogus = 1;
break;
}
if (nread != 1 || bogus)
break;
line[len] = 0;
char * dot = ACE_OS::strchr (line,'.');
if (dot)
*dot = 0;
char * libname = line + 3; // skip over "lib"
// check to see if this is a new library
int found = 0;
for (int i = 0; !found && i < num_libs_; i++)
found = (libs_[i]->name() == libname);
if (!found) {
Library *nlib = new Library(libname);
ACE_OS::memset (line,0,max_line_length);
// skip over '=> '
if (ACE_OS::read(pipe[0],line,3) != 3)
break;
// get library path
len = 0;
while ((nread = ACE_OS::read(pipe[0],line + len,1)) == 1 &&
(line[len] != ' '))
if (! bogus && ++len == max_line_length)
{
bogus = 1;
break;
}
if (nread != 1 || bogus)
break;
line[len] = 0;
nlib->set_path (line);
libs_[num_libs_++] = nlib;
ACE_ASSERT (num_libs_ < max_libs_); // grow max libs?
}
// skip the rest of the line
while ((nread = ACE_OS::read(pipe[0],line,1)) == 1 && *line != '\n');
if (nread != 1)
break;
}
proc.wait ();
ACE_OS::close (pipe[0]);
undef_wrapper_.add_source(path,1);
// now do the ldd, iterate over the results to add new libs, etc.
}
示例6: if
pid_t
ACE_Process_Manager::wait (pid_t pid,
const ACE_Time_Value &timeout,
ACE_exitcode *status)
{
ACE_TRACE ("ACE_Process_Manager::wait");
ACE_exitcode local_stat = 0;
if (status == 0)
status = &local_stat;
*status = 0;
ssize_t idx = -1;
ACE_Process *proc = 0;
{
// fake context after which the lock is released
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
if (pid != 0)
{
idx = this->find_proc (pid);
if (idx == -1)
return ACE_INVALID_PID;
else
proc = process_table_[idx].process_;
}
// release the lock.
}
if (proc != 0)
pid = proc->wait (timeout, status);
else
{
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
// Wait for any Process spawned by this Process_Manager.
#if defined (ACE_WIN32)
HANDLE *handles = 0;
ACE_NEW_RETURN (handles,
HANDLE[this->current_count_],
ACE_INVALID_PID);
for (size_t i = 0;
i < this->current_count_;
++i)
handles[i] =
process_table_[i].process_->gethandle ();
DWORD handle_count = static_cast<DWORD> (this->current_count_);
DWORD result = ::WaitForMultipleObjects (handle_count,
handles,
FALSE,
timeout == ACE_Time_Value::max_time
? INFINITE
: timeout.msec ());
if (result == WAIT_FAILED)
pid = ACE_INVALID_PID;
else if (result == WAIT_TIMEOUT)
pid = 0;
else
{
// Green Hills produces a warning that result >=
// WAIT_OBJECT_0 is a pointless comparison because
// WAIT_OBJECT_0 is zero and DWORD is unsigned long, so this
// test is skipped for Green Hills. Same for mingw.
# if defined (__MINGW32__) || defined (_MSC_VER)
ACE_ASSERT (result < WAIT_OBJECT_0 + this->current_count_);
# else
ACE_ASSERT (result >= WAIT_OBJECT_0
&& result < WAIT_OBJECT_0 + this->current_count_);
# endif
idx = this->find_proc (handles[result - WAIT_OBJECT_0]);
if (idx != -1)
{
pid = process_table_[idx].process_->getpid ();
result = ::GetExitCodeProcess (handles[result - WAIT_OBJECT_0],
status);
if (result == 0)
{
// <GetExitCodeProcess> failed!
this->remove_proc (idx);
pid = ACE_INVALID_PID;
}
}
else
{
// uh oh...handle removed from process_table_, even though
// we're holding a lock!
delete [] handles;
ACELIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Process removed")
ACE_TEXT (" -- somebody's ignoring the lock!\n")),
-1);
}
}
delete [] handles;
//.........这里部分代码省略.........
示例7: defined
int
run_main (int argc, ACE_TCHAR *argv[])
{
#if defined (ACE_LACKS_FORK)
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
ACE_START_TEST (ACE_TEXT ("Process_Semaphore_Test"));
ACE_ERROR ((LM_INFO,
ACE_TEXT ("fork is not supported on this platform\n")));
ACE_END_TEST;
#else
parse_args (argc, argv);
// Child process code.
if (child_process)
{
ACE_START_TEST (ACE_TEXT ("Process_Semaphore_Test-child"));
acquire_release ();
ACE_END_LOG;
}
else
{
ACE_START_TEST (ACE_TEXT ("Process_Semaphore_Test"));
ACE_TString exe_sub_dir;
const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR");
if (subdir_env)
{
exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env);
exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR;
}
ACE_Process_Options options;
options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("%sProcess_Semaphore_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c -i %d"),
exe_sub_dir.c_str(),
iterations);
// Spawn a child process that will contend for the
// lock.
ACE_Process child;
// Spawn the child process.
int result = child.spawn (options);
ACE_TEST_ASSERT (result != -1);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Parent spawned child process with pid = %d.\n"),
child.getpid ()));
// start test
acquire_release ();
ACE_exitcode child_status;
// Wait for the child processes we created to exit.
ACE_TEST_ASSERT (child.wait (&child_status) != -1);
if (child_status == 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Child %d finished ok\n"),
child.getpid ()));
else
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Child %d finished with status %d\n"),
child.getpid (), child_status));
ACE_END_TEST;
}
#endif /* ! ACE_LACKS_FORK */
return 0;
}
示例8: options
int
run_main (int argc, ACE_TCHAR *argv[])
{
#if defined (ACE_WIN32)
get_base_addrs();
#endif
if (argc == 1)
{
ACE_START_TEST (ACE_TEXT ("Malloc_Test"));
ACE_INIT_LOG (ACE_TEXT ("Malloc_Test-child"));
init_test (PARENT_BASE_ADDR);
ACE_Control_Block::print_alignment_info ();
# if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
ACE_PI_Control_Block::print_alignment_info ();
# endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
// No arguments means we're the parent process.
ACE_Process_Options options (1);
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
static const ACE_TCHAR* format = ACE_TEXT ("%ls%ls%ls");
#else
static const ACE_TCHAR* format = ACE_TEXT ("%s%s%s");
#endif /* !ACE_WIN32 && ACE_USES_WCHAR */
options.command_line (format, EXE_LOCATION,
argc > 0 ? argv[0] : ACE_TEXT ("Malloc_Test"),
ACE_TEXT (" run_as_test"));
MALLOC *myalloc = myallocator (PARENT_BASE_ADDR);
Test_Data *data = initialize (myalloc);
ACE_TEST_ASSERT (data != 0);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P) PARENT allocator at = %@, ")
ACE_TEXT ("data allocated at %@\n"),
myalloc,
data));
myalloc->dump ();
int result = myalloc->bind ("foo", data);
ACE_TEST_ASSERT (result != -1);
ACE_Process p;
pid_t pid = p.spawn (options);
if (pid == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("spawn")), 1);
parent (data);
// Synchronize on the exit of the child.
result = p.wait ();
if (result == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("wait")), 1);
ACE_TEST_ASSERT (myalloc->ref_counter () == 1);
myalloc->remove ();
ACE_END_TEST;
return 0;
}
else
{
// In this case we're the child process.
ACE_APPEND_LOG (ACE_TEXT ("Malloc_Test-child"));
void *data = 0;
MALLOC *myalloc = myallocator (CHILD_BASE_ADDR);
int result = myalloc->find ("foo", data);
ACE_TEST_ASSERT (result != -1);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P) CHILD allocator at = %@, ")
ACE_TEXT ("data allocated at %@\n"),
myalloc,
data));
myalloc->dump ();
child ();
myalloc->release ();
ACE_END_LOG;
return 0;
}
}
示例9: options
int
// This has been unconditionally turned on for the time being since I can't
// figure out an easy way to enable it and still keep ACE_TMAIN in a seperate
// cpp.
#if 1 || defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) || defined (ACE_LACKS_FORK)
// ACE_HAS_NONSTATIC_OBJECT_MANAGER only allows main to have two
// arguments. And on platforms that lack fork (), we can't use spawn.
run_main (int, ACE_TCHAR* [])
{
// Only Win32 can set wide-char environment strings. So, for all
// others, use char string literals regardless of ACE_USES_WCHAR.
# if defined (ACE_WIN32)
ACE_OS::putenv (ACE_TEXT ("TEST_VALUE_POSITIVE=10.2"));
ACE_OS::putenv (ACE_TEXT ("TEST_VALUE_NEGATIVE=-10.2"));
# else
ACE_OS::putenv ("TEST_VALUE_POSITIVE=10.2");
ACE_OS::putenv ("TEST_VALUE_NEGATIVE=-10.2");
# endif /* ACE_WIN32 */
#else /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER && ! ACE_LACKS_FORK */
run_main (int argc, ACE_TCHAR * [], ACE_TCHAR *envp[])
{
if (argc == 1)
{
int status;
// No arguments means we're the initial test.
ACE_Process_Options options (1);
status = options.setenv (envp);
if (status != 0)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("setenv(envp)")));
options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("Env_Value_Test run_as_test"));
status = options.setenv (ACE_TEXT ("TEST_VALUE_POSITIVE"),
ACE_TEXT ("%s"),
ACE_TEXT ("10.2"));
if (status != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("setenv(TEST_VALUE_POSITIVE)")));
status = options.setenv (ACE_TEXT ("TEST_VALUE_NEGATIVE"),
ACE_TEXT ("%s"),
ACE_TEXT ("-10.2"));
if (status != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("setenv(TEST_VALUE_NEGATIVE)")));
ACE_Process p;
pid_t result = p.spawn (options);
if (result == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")));
else
p.wait ();
}
else
#endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER && ! ACE_LACKS_FORK */
{
// In this case we're the child
ACE_START_TEST (ACE_TEXT ("Env_Value_Test"));
TEST_THIS (int, ACE_TEXT ("TEST_VALUE_POSITIVE"), 4, 10);
TEST_THIS (double, ACE_TEXT ("TEST_VALUE_POSITIVE"), -1.0, 10.2);
TEST_THIS (long, ACE_TEXT ("TEST_VALUE_POSITIVE"), 0, 10);
TEST_THIS (unsigned long, ACE_TEXT ("TEST_VALUE_POSITIVE"), 0, 10);
TEST_THIS (short, ACE_TEXT ("TEST_VALUE_POSITIVE"), 0, 10);
TEST_THIS (unsigned short, ACE_TEXT ("TEST_VALUE_POSITIVE"), 0, 10);
TEST_THIS (int, ACE_TEXT ("TEST_VALUE_NEGATIVE"), 4, -10);
TEST_THIS (double, ACE_TEXT ("TEST_VALUE_NEGATIVE"), -1.0, -10.2);
TEST_THIS (long, ACE_TEXT ("TEST_VALUE_NEGATIVE"), 0, -10L);
TEST_THIS (unsigned long, ACE_TEXT ("TEST_VALUE_NEGATIVE"), 0, (unsigned long) -10);
TEST_THIS (short, ACE_TEXT ("TEST_VALUE_NEGATIVE"), 0, -10);
TEST_THIS (unsigned short, ACE_TEXT ("TEST_VALUE_NEGATIVE"), 0, (unsigned short) -10);
const ACE_TCHAR *defstr = ACE_TEXT ("Sarah Cleeland is Two!");
ACE_Env_Value<const ACE_TCHAR *> sval (ACE_TEXT ("This_Shouldnt_Be_Set_Hopefully"),
defstr);
if (ACE_OS::strcmp (sval, defstr) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Mismatch: %s should be %s\n"),
(const ACE_TCHAR *)sval, defstr));
ACE_END_TEST;
}
return 0;
}