webserver target

master
Marc Wäckerlin 21 years ago
parent 58e685c386
commit 30d3d92276
  1. 11
      configure.in
  2. 10
      makefile.am
  3. 4
      mrw/doxyfile.in
  4. 2
      mrw/exec.cpp
  5. 39
      mrw/exec_test.cpp
  6. 33
      mrw/makefile.am
  7. 24
      mrw/mrw.hpp.in
  8. 41
      mrw/stacktrace_test.cpp

@ -1,7 +1,7 @@
AC_INIT([mrw/mrw.hpp]) AC_INIT([mrw/stacktrace.hpp])
PACKAGENAME=mrw-c++ PACKAGENAME=mrw-c++
MAJOR=0 MAJOR=0
MINOR=01 MINOR=10
SUPPORT=alfa SUPPORT=alfa
AM_INIT_AUTOMAKE(@PACKAGENAME@, @MAJOR@.@MINOR@) AM_INIT_AUTOMAKE(@PACKAGENAME@, @MAJOR@.@MINOR@)
@ -19,8 +19,8 @@ AC_CHECK_PROG(have_doxygen, doxygen, yes, no)
AC_CHECK_PROG(have_dot, dot, yes, no) AC_CHECK_PROG(have_dot, dot, yes, no)
# libraries # libraries
#AC_SEARCH_LIBS(demangle, iberty) AC_SEARCH_LIBS(cplus_demangle, iberty)
#AC_SEARCH_LIBS(, bfd) AC_SEARCH_LIBS(bfd_get_symbol_leading_char, bfd)
# Arguments # Arguments
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
@ -37,7 +37,8 @@ AC_SUBST(SUPPORT)
AC_SUBST(PACKAGENAME) AC_SUBST(PACKAGENAME)
# create output # create output
AC_CONFIG_FILES([makefile mrw/makefile mrw/doxyfile]) AC_CONFIG_FILES([makefile mrw/makefile mrw/doxyfile mrw/mrw.hpp])
AC_OUTPUT
# infos and warnings # infos and warnings
if test "$have_doxygen" = "no"; then if test "$have_doxygen" = "no"; then

@ -1 +1,11 @@
SUBDIRS = mrw SUBDIRS = mrw
include_HEADERS = mrw/auto.hpp mrw/unistd.hpp \
mrw/stacktrace.hpp mrw/exception.hpp \
mrw/exec.hpp
data_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
webserver: doc dist
mkdir /home/www/marc/mrw-c++
cp mrw/doc/html/* /home/www/marc/mrw-c++/
cp @PACKAGENAME@-@MAJOR@.@MINOR@.tar.gz /home/www/marc/mrw-c++/

@ -23,7 +23,7 @@ PROJECT_NAME = "MRW C++ Library"
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = experimental PROJECT_NUMBER = "@MAJOR@.@MINOR@@SUPPORT@"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
@ -387,7 +387,7 @@ EXCLUDE_PATTERNS =
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see
# the \include command). # the \include command).
EXAMPLE_PATH = examples EXAMPLE_PATH = examples ..
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp

@ -4,8 +4,6 @@
#include <unistd.h> // fork, exec #include <unistd.h> // fork, exec
#include <string.h> // memcpy #include <string.h> // memcpy
#include <iostream>
mrw::ExecutionFailedExc::ExecutionFailedExc(const std::string& w, mrw::ExecutionFailedExc::ExecutionFailedExc(const std::string& w,
const std::string& c) const std::string& c)
throw(std::bad_exception): throw(std::bad_exception):

@ -1,22 +1,29 @@
#include <mrw/exec.hpp> #include <mrw/exec.hpp>
#include <mrw/stacktrace.hpp> #include <mrw/stacktrace.hpp>
#include <cppunit/TestFixture.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <string>
#include <iostream> #include <iostream>
class ExecTest: public CppUnit::TestFixture {
public:
void lsTest() {
std::string res = (mrw::Cmd("/bin/ls"), "-l", "..").execute();
CPPUNIT_ASSERT(res.find("COPYING")<res.size());
}
void excTest() {
std::string res = (mrw::Cmd("/bin/false")).execute().result();
}
CPPUNIT_TEST_SUITE(ExecTest);
CPPUNIT_TEST(lsTest);
CPPUNIT_TEST_EXCEPTION(excTest, mrw::ExecutionFailedExc);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(ExecTest);
int main() { int main() {
// std::cout<<"RESULT: " CppUnit::TextUi::TestRunner runner;
// <<(mrw::Cmd("/bin/ls"), "-l", "/tmp").execute().result() runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
// <<std::endl; return runner.run() ? 0 : 1;
try {
std::cout<<"RESULT: "
<<(mrw::Cmd("/bin/false")).execute().result()
<<std::endl;
} catch (const mrw::exception &x) {
mrw::StackTrace::createSymtable();
std::cout<<"EXCEPTION: ----------------------------------------"<<std::endl
<<"---------- Reason:"<<std::endl
<<x.what()<<std::endl
<<"---------- Stack:"<<std::endl
<<x.stacktrace()<<std::endl
<<"---------------------------------------------------"<<std::endl;
}
} }

@ -1,17 +1,36 @@
EXTRA_DIST = doc examples CLEANFILES = doxygen.error
CLEANFILES = doxygen.err AM_CPPFLAGS = -I..
lib_LTLIBRARIES = libmrw.la libautostacktracestderr.la examplesdir = ${pkgdatadir}/examples
examples_DATA = examples/*
htmldir = ${pkgdatadir}/doc/html
html_DATA = doc/html/*
EXTRA_DIST = test.dat ${examples_DATA} ${html_DATA}
lib_LTLIBRARIES = libmrw.la libmrwexcstderr.la
libmrw_la_SOURCES = mrw.hpp \ libmrw_la_SOURCES = mrw.hpp \
auto.hpp auto.cpp unistd.hpp \ auto.hpp auto.cpp unistd.hpp \
stacktrace.hpp stacktrace.cpp exception.hpp \ stacktrace.hpp stacktrace.cpp exception.hpp exception.cpp \
exec.hpp exec.cpp exec.hpp exec.cpp
libmrw_la_LDFLAGS = -version-info @MAJOR@:@MINOR@:@SUPPORT@ libmrw_la_LDFLAGS = -version-info @MAJOR@:@MINOR@
libmrw_la_LIBADD = -liberty -lbfd
libautostacktracestderr_la_SOURCES = autostacktracestderr.cpp libmrwexcstderr_la_SOURCES = autostacktracestderr.cpp
libautostacktracestderr_la_LDFLAGS = -version-info @MAJOR@:@MINOR@:@SUPPORT@ libmrwexcstderr_la_LDFLAGS = -version-info @MAJOR@:@MINOR@
libmrwexcstderr_la_LIBADD = -lmrw
check_PROGRAMS = auto_test exec_test stacktrace_test
auto_test_SOURCES = auto_test.cpp
auto_test_CPPFLAGS = -I.. -g3
auto_test_LDADD = -lmrw -lcppunit
exec_test_SOURCES = exec_test.cpp
exec_test_CPPFLAGS = -I.. -g3
exec_test_LDADD = -lmrw -lcppunit
stacktrace_test_SOURCES = stacktrace_test.cpp
stacktrace_test_CPPFLAGS = -I.. -g3
stacktrace_test_LDADD = -lmrw -lcppunit
TESTS = ${check_PROGRAMS}
doc: doc/html/index.html doc: doc/html/index.html
doc/html/index.html: doxyfile *.[ch]pp doc/html/index.html: doxyfile *.[ch]pp

@ -27,15 +27,31 @@
@section download Download and Installation @section download Download and Installation
Download the latest version from: Download this version from here:
- http://marc.waeckerlin.org/c++/libmrw - http://marc.waeckerlin.org/c++/libmrw/mrw-c++-@MAJOR@.@MINOR@.tar.gz
- http://marc.waeckerlin.org/c++/libmrw/mrw-c++-@MAJOR@.@MINOR@.rpm
The homepage is on:
- http://marc.waeckerlin.org/c++/libmrw/index.html
Install it with: Install it with:
@verbatim @verbatim
tar xzvf mrw-c++-<VERSION>.tar.gz tar xzvf mrw-c++-@MAJOR@.@MINOR@.tar.gz
cd mrw-c++-<VERSION> cd mrw-c++-@MAJOR@.@MINOR@
./configure ./configure
make all check install make all check install
@endverbatim @endverbatim
*/ */
/** @page license License
@verbinclude COPYING */
/** @page readme Readme
@verbinclude README */
/** @page news News
@verbinclude NEWS */
/** @page changes Change Log
@verbinclude ChangeLog */

@ -3,27 +3,28 @@
#include <cppunit/ui/text/TestRunner.h> #include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <iostream>
class StackTraceTest: public CppUnit::TestFixture { namespace mrw {
public: class StackTraceTest: public CppUnit::TestFixture {
/// test if symbols are correctely evaluated public:
void StackTrace() { /// test if symbols are correctely evaluated
mrw::StackTrace::createSymtable(); void StackTrace() {
mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__); mrw::StackTrace::createSymtable();
std::stringstream ss; mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__);
ss<<f<<':'<<l; std::stringstream ss;
std::string st(s); ss<<f<<':'<<l;
int pos(st.find(ss.str())); std::string st(s);
std::cout<<st<<std::endl; int pos(st.find(ss.str()));
CPPUNIT_ASSERT(pos<st.size()); CPPUNIT_ASSERT(pos<st.size());
CPPUNIT_ASSERT(st.find("mrw::StackTrace::StackTrace()", pos)<st.size()); CPPUNIT_ASSERT(st.find("mrw::StackTraceTest::StackTrace()", pos)
} < st.size());
CPPUNIT_TEST_SUITE(StackTraceTest); }
CPPUNIT_TEST(StackTrace); CPPUNIT_TEST_SUITE(StackTraceTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST(StackTrace);
}; CPPUNIT_TEST_SUITE_END();
CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest); };
CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest);
}
int main() { int main() {
CppUnit::TextUi::TestRunner runner; CppUnit::TextUi::TestRunner runner;

Loading…
Cancel
Save