webserver target
This commit is contained in:
		
							
								
								
									
										11
									
								
								configure.in
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								configure.in
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
AC_INIT([mrw/mrw.hpp])
 | 
			
		||||
AC_INIT([mrw/stacktrace.hpp])
 | 
			
		||||
PACKAGENAME=mrw-c++
 | 
			
		||||
MAJOR=0
 | 
			
		||||
MINOR=01
 | 
			
		||||
MINOR=10
 | 
			
		||||
SUPPORT=alfa
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
# libraries
 | 
			
		||||
#AC_SEARCH_LIBS(demangle, iberty)
 | 
			
		||||
#AC_SEARCH_LIBS(, bfd)
 | 
			
		||||
AC_SEARCH_LIBS(cplus_demangle, iberty)
 | 
			
		||||
AC_SEARCH_LIBS(bfd_get_symbol_leading_char, bfd)
 | 
			
		||||
 | 
			
		||||
# Arguments
 | 
			
		||||
AM_MAINTAINER_MODE
 | 
			
		||||
@@ -37,7 +37,8 @@ AC_SUBST(SUPPORT)
 | 
			
		||||
AC_SUBST(PACKAGENAME)
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
if test "$have_doxygen" = "no"; then
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								makefile.am
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								makefile.am
									
									
									
									
									
								
							@@ -1 +1,11 @@
 | 
			
		||||
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 
 | 
			
		||||
# 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) 
 | 
			
		||||
# 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 
 | 
			
		||||
# the \include command).
 | 
			
		||||
 | 
			
		||||
EXAMPLE_PATH           = examples
 | 
			
		||||
EXAMPLE_PATH           = examples ..
 | 
			
		||||
 | 
			
		||||
# 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 
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,6 @@
 | 
			
		||||
#include <unistd.h> // fork, exec
 | 
			
		||||
#include <string.h>  // memcpy
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
mrw::ExecutionFailedExc::ExecutionFailedExc(const std::string& w,
 | 
			
		||||
                                            const std::string& c)
 | 
			
		||||
  throw(std::bad_exception):
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,29 @@
 | 
			
		||||
#include <mrw/exec.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>
 | 
			
		||||
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() {
 | 
			
		||||
//   std::cout<<"RESULT: "
 | 
			
		||||
//            <<(mrw::Cmd("/bin/ls"), "-l", "/tmp").execute().result()
 | 
			
		||||
//            <<std::endl;
 | 
			
		||||
  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;
 | 
			
		||||
  }
 | 
			
		||||
  CppUnit::TextUi::TestRunner runner;
 | 
			
		||||
  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
 | 
			
		||||
  return runner.run() ? 0 : 1;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,36 @@
 | 
			
		||||
EXTRA_DIST = doc examples
 | 
			
		||||
CLEANFILES = doxygen.err
 | 
			
		||||
CLEANFILES = doxygen.error
 | 
			
		||||
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 \
 | 
			
		||||
                    auto.hpp auto.cpp unistd.hpp \
 | 
			
		||||
		    stacktrace.hpp stacktrace.cpp exception.hpp \
 | 
			
		||||
		    stacktrace.hpp stacktrace.cpp exception.hpp exception.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
 | 
			
		||||
libautostacktracestderr_la_LDFLAGS = -version-info @MAJOR@:@MINOR@:@SUPPORT@
 | 
			
		||||
libmrwexcstderr_la_SOURCES = autostacktracestderr.cpp
 | 
			
		||||
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/html/index.html: doxyfile *.[ch]pp
 | 
			
		||||
 
 | 
			
		||||
@@ -27,15 +27,31 @@
 | 
			
		||||
 | 
			
		||||
    @section download Download and Installation
 | 
			
		||||
 | 
			
		||||
    Download the latest version from:
 | 
			
		||||
     - http://marc.waeckerlin.org/c++/libmrw
 | 
			
		||||
    Download this version from here:
 | 
			
		||||
     - 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:
 | 
			
		||||
    
 | 
			
		||||
    @verbatim
 | 
			
		||||
    tar xzvf mrw-c++-<VERSION>.tar.gz
 | 
			
		||||
    cd mrw-c++-<VERSION>
 | 
			
		||||
    tar xzvf mrw-c++-@MAJOR@.@MINOR@.tar.gz
 | 
			
		||||
    cd mrw-c++-@MAJOR@.@MINOR@
 | 
			
		||||
    ./configure
 | 
			
		||||
    make all check install
 | 
			
		||||
    @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/extensions/HelperMacros.h>
 | 
			
		||||
#include <cppunit/extensions/TestFactoryRegistry.h>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
class StackTraceTest: public CppUnit::TestFixture { 
 | 
			
		||||
public:
 | 
			
		||||
  /// test if symbols are correctely evaluated
 | 
			
		||||
  void StackTrace() {
 | 
			
		||||
    mrw::StackTrace::createSymtable();
 | 
			
		||||
    mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__);
 | 
			
		||||
    std::stringstream ss;
 | 
			
		||||
    ss<<f<<':'<<l;
 | 
			
		||||
    std::string st(s);
 | 
			
		||||
    int pos(st.find(ss.str()));
 | 
			
		||||
    std::cout<<st<<std::endl;
 | 
			
		||||
    CPPUNIT_ASSERT(pos<st.size());
 | 
			
		||||
    CPPUNIT_ASSERT(st.find("mrw::StackTrace::StackTrace()", pos)<st.size());
 | 
			
		||||
  }
 | 
			
		||||
  CPPUNIT_TEST_SUITE(StackTraceTest);
 | 
			
		||||
  CPPUNIT_TEST(StackTrace);
 | 
			
		||||
  CPPUNIT_TEST_SUITE_END();
 | 
			
		||||
};
 | 
			
		||||
CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest);
 | 
			
		||||
namespace mrw {
 | 
			
		||||
  class StackTraceTest: public CppUnit::TestFixture { 
 | 
			
		||||
  public:
 | 
			
		||||
    /// test if symbols are correctely evaluated
 | 
			
		||||
    void StackTrace() {
 | 
			
		||||
      mrw::StackTrace::createSymtable();
 | 
			
		||||
      mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__);
 | 
			
		||||
      std::stringstream ss;
 | 
			
		||||
      ss<<f<<':'<<l;
 | 
			
		||||
      std::string st(s);
 | 
			
		||||
      int pos(st.find(ss.str()));
 | 
			
		||||
      CPPUNIT_ASSERT(pos<st.size());
 | 
			
		||||
      CPPUNIT_ASSERT(st.find("mrw::StackTraceTest::StackTrace()", pos)
 | 
			
		||||
                     < st.size());
 | 
			
		||||
    }
 | 
			
		||||
    CPPUNIT_TEST_SUITE(StackTraceTest);
 | 
			
		||||
    CPPUNIT_TEST(StackTrace);
 | 
			
		||||
    CPPUNIT_TEST_SUITE_END();
 | 
			
		||||
  };
 | 
			
		||||
  CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
  CppUnit::TextUi::TestRunner runner;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user