Просмотр исходного кода

Initial version (from Jens Maurer)

[SVN r8489]
Beman Dawes 25 лет назад
Родитель
Сommit
338a6a8fe4
3 измененных файлов с 382 добавлено и 0 удалено
  1. 95 0
      libs/compiler.cfg
  2. 34 0
      libs/regression.cfg
  3. 253 0
      libs/regression.cpp

+ 95 - 0
libs/compiler.cfg

@@ -0,0 +1,95 @@
+linux
+gcc
+GCC 2.95.2
+g++ -ftemplate-depth-30 -I%include %source
+GNU<br>GCC<br>2.95.2
+
+linux
+gcc-stlport
+GCC 2.95.2 STLport 4.0
+g++ -V 2.95.2-stlport -ftemplate-depth-30 -I%include %source
+GNU<br>GCC<br>2.95.2<br>STLport<br>4.0
+
+linux
+como
+Comeau C++ 4.2.44 beta3
+como -I%include %source
+Comeau C++<br>4.2.44 beta3<br>STLport<br>4.0
+
+sunos5
+suncc
+Sun WorkShop 6 2000/04/07 C++ 5.1
+CC -I%include %source
+Sun C++<br>Sun WorkShop 6, C++ 5.1
+
+sunos5
+gcc
+GCC 2.95.2
+g++ -Wall -pedantic -ftemplate-depth-30 -Wno-long-long -I%include %source
+GNU<br>GCC<br>2.95.2
+
+sunos5
+kcc
+KCC 3.4g
+KCC --strict_warnings -I%include %source
+KAI<br>KCC<br>3.4g
+
+osf1V5
+cxx
+Compaq C++ 6.0
+cxx -std strict_ansi -D__USE_STD_IOSTREAM -I%include %source
+Compaq C++<br>6.2-024
+
+osf1V5
+cxx-clib
+Compaq C++ 6.0 with <cXXX> headers
+cxx -std strict_ansi -D__USE_STD_IOSTREAM -I$HOME/include -I%include %source
+Compaq C++<br>6.2-024<br>clib
+
+irix6
+irixcc
+IRIX CC 7.1.3.3
+CC -LANG:std -I%include %source
+SGI IRIX CC<br>7.3.1.1m
+
+irix6
+irixcc-clib
+IRIX CC 7.1.3.3 with <cXXX> headers
+CC -LANG:std -I$HOME/include -I%include %source
+SGI IRIX CC<br>7.3.1.1m<br>clib
+
+beos
+gcc
+GNU GCC
+c++ -ftemplate-depth-30 -Wall -I%include %source
+GNUPro<br>GCC&nbsp;2.9
+
+beos
+gcc-stlport
+GNU GCC
+c++ -ftemplate-depth-30 -Wall -I/boot/home/config/stlport/stl330 -I%include %source
+GNUPro<br>GCC&nbsp;2.9<br>+<br>SGI&nbsp;STL&nbsp;3.3
+
+win32
+bcc
+Borland C++ 5.5.1
+$BOOST_BCC55_PATH\bcc32 -I%include -j10 -q %source
+Borland<br>BCC<br>5.5.1
+
+win32
+cw
+Metrowerks CodeWarrior
+mwcc -maxerrors 10 -cwd source -I- -I%include %source
+Metrowerks<br>CodeWarrior<br>6.0
+
+win32
+vc
+Microsoft Visual C++
+cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "%include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" %source
+Microsoft<br>VC++<br>6.0 SP4
+
+win32
+vc-stlport
+Microsoft Visual C++ with STLport
+cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "$BOOST_STLPORT_PATH" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" %source
+Microsoft<br>VC++<br>6.0 SP4<br>STLport<br>4.0

+ 34 - 0
libs/regression.cfg

@@ -0,0 +1,34 @@
+compile libs/config/config_test.cpp
+run libs/array/array1.cpp
+compile libs/concept_check/concept_check_test.cpp
+compile libs/concept_check/class_concept_check_test.cpp
+link-fail libs/concept_check/concept_check_fail_expected.cpp
+link-fail libs/concept_check/class_concept_fail_expected.cpp
+run libs/functional/function_test.cpp
+run libs/graph/test/graph.cpp
+run libs/integer/cstdint_test.cpp
+run libs/integer/integer_test.cpp
+run libs/integer/integer_traits_test.cpp
+run libs/rational/rational_example.cpp
+run libs/random/random_test.cpp
+run libs/random/random_demo.cpp
+run libs/regex/demo/regress/regex_test.cpp
+run libs/regex/demo/regress/wregex_test.cpp
+run libs/smart_ptr/smart_ptr_test.cpp
+compile libs/static_assert/static_assert_test.cpp
+compile-fail libs/static_assert/static_assert_test_fail_1.cpp
+compile-fail libs/static_assert/static_assert_test_fail_2.cpp
+compile-fail libs/static_assert/static_assert_test_fail_3.cpp
+compile-fail libs/static_assert/static_assert_test_fail_4.cpp
+compile-fail libs/static_assert/static_assert_test_fail_5.cpp
+compile-fail libs/static_assert/static_assert_test_fail_6.cpp
+compile-fail libs/static_assert/static_assert_test_fail_7.cpp
+compile-fail libs/static_assert/static_assert_test_fail_8.cpp
+compile libs/utility/call_traits_test.cpp
+run libs/cast_test.cpp
+compile libs/utility/compressed_pair_test.cpp
+run libs/utility/iterator_adaptor_test.cpp
+run libs/utility/iterators_test.cpp
+run libs/utility/operators_test.cpp
+run libs/utility/tie_example.cpp
+compile libs/utility/type_traits_test.cpp

+ 253 - 0
libs/regression.cpp

@@ -0,0 +1,253 @@
+/* boost regression test program
+ *
+ * Copyright Jens Maurer 2000
+ * Permission to use, copy, modify, sell, and distribute this software
+ * is hereby granted without free provided that the above copyright notice
+ * appears in all copies and that both that copyright notice and this
+ * permission notice appear in supporting documentation,
+ *
+ * Jens Maurer makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ */
+
+#include <iostream>
+#include <string>
+#include <list>
+#include <vector>
+#include <cstdlib>
+#include <fstream>
+#include <utility>
+
+
+std::string get_host()
+{
+#if defined __linux__
+  return "linux";
+#elif defined _MSC_VER
+  return "win32";
+#else
+#error Please adapt for your platform
+#endif
+}
+
+
+struct entry
+{
+  std::string os, identifier, name, command, html;
+};
+
+void replace(std::string & s,
+	     const std::string & name, const std::string & value)
+{
+  std::string::size_type p = s.find(name);
+  if(p != std::string::npos)
+    s.replace(p, name.length(), value);
+}
+
+void replace_environment(std::string & s)
+{
+  std::string::size_type end = 0;
+  for(;;) {
+    std::string::size_type pos = s.find('$', end);
+    if(pos == std::string::npos)
+      break;
+    end = s.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_", pos+1);
+    const char * env = getenv(s.substr(pos+1, end-pos-1).c_str());
+    if(env)
+      replace(s, s.substr(pos, end-pos), env);
+    else
+      break;
+  }
+}
+
+template<class OutputIterator>
+void read_compiler_configuration(const std::string & file, OutputIterator out)
+{
+  std::ifstream f(file.c_str());
+  int lineno = 0;
+  while(f.good()) {
+    entry e;
+    std::getline(f, e.os);
+    std::getline(f, e.identifier);
+    std::getline(f, e.name);
+    std::getline(f, e.command);
+    std::getline(f, e.html);
+    *out = e;
+    ++out;
+    std::string l;
+    std::getline(f, l);
+    lineno += 6;
+    if(l != "") {
+      std::cerr << file << ", line " << lineno
+		<< ": Empty line expected, got " << l << "\n";
+      std::exit(1);
+    }
+  }
+}
+
+bool execute(const std::string & command)
+{
+  std::cout << command << "\n";
+  return std::system(command.c_str()) == 0;
+}
+
+enum test_result {
+  ok = 0,
+  unknown_type,
+  compile_failed, compile_ok, link_failed, link_ok, run_failed, run_ok
+};
+
+test_result compile(std::string command, const std::string & boostpath,
+	     const std::string & file)
+{
+  replace(command, "%source", "-o boosttmp.o " + boostpath + "/" + file);
+  return execute(command) ? compile_ok : compile_failed;
+}
+
+test_result link(std::string command, const std::string & boostpath,
+		 const std::string & file)
+{
+  replace(command, "%source", "-o boosttmp.exe" + boostpath + "/" + file);
+  return execute(command) ? link_ok : link_failed;
+}
+
+test_result run(std::string command, const std::string & boostpath,
+		const std::string & file)
+{
+  std::string exename = "boosttmp.exe";
+  replace(command, "%source", "-o " + exename + " " + boostpath + "/" + file);
+  if(execute(command)) {
+    return execute( (get_host() == "win32" ? "" : "./") + exename ) ?
+      run_ok : run_failed;
+  } else {
+    return link_failed;
+  }
+}
+
+std::pair<test_result, test_result>
+run_test(const std::string & type, std::string command,
+	 const std::string & boostpath, const std::string & source)
+{
+  replace(command, "%include", boostpath);
+  if(type == "compile")
+    return std::make_pair(compile(command, boostpath, source), compile_ok);
+  else if(type == "compile-fail")
+    return std::make_pair(compile(command, boostpath, source), compile_failed);
+  else if(type == "link")
+    return std::make_pair(link(command, boostpath, source), link_ok);
+  else if(type == "link-fail")
+    return std::make_pair(link(command, boostpath, source), link_failed);
+  else if(type == "run")
+    return std::make_pair(run(command, boostpath, source), run_ok);
+  else if(type == "run-fail")
+    return std::make_pair(run(command, boostpath, source), run_failed);
+  else
+    return std::make_pair(unknown_type, ok);
+}
+
+template<class ForwardIterator>
+void do_tests(std::ostream & out,
+	      ForwardIterator firstcompiler, ForwardIterator lastcompiler,
+	      const std::string & testconfig, const std::string & boostpath)
+{
+  out << "<tr>\n"
+      << "<td>Program</td>\n";
+  for(ForwardIterator it = firstcompiler; it != lastcompiler; ++it) {
+    out << "<td>" << it->html << "</td>\n";
+  }
+  out << "</tr>\n";
+
+  std::ifstream f(testconfig.c_str());
+  while(f.good()) {
+    std::string l;
+    std::getline(f, l);
+    typedef std::string::size_type sz_type;
+    sz_type p = l.find(' ');
+    if(p == std::string::npos) {
+      std::cerr << "Test " << l << " is wrong\n";
+      continue;
+    }
+    std::string type(l, 0, p);
+    std::string file(l, p+1);
+
+    std::cout << file << "\n";
+
+    out << "<tr>\n"
+	<< "<td><a href=\"" << file << "\">" << file << "</a></td>\n";
+
+    for(ForwardIterator it = firstcompiler; it != lastcompiler; ++it) {
+      std::cout << "\t" << it->name << std::endl;
+      std::pair<test_result, test_result> result =
+	run_test(type, it->command, boostpath, file);
+      if(result.first == unknown_type) {
+	std::cerr << "Unknown test type " << type << ", skipped\n";
+	continue;
+      }
+      out << "<td>";
+      if(result.first == result.second)
+	out << "yes";
+      else
+	out << "no";
+      out << "<sup>" << int(result.second) << "</sup></td>" << std::endl;
+      std::cout << (result.first == result.second ? "ok" : "failed") << "\n";
+    }
+    out << "</tr>\n";
+  }
+}
+	      
+
+int main(int argc, char * argv[])
+{
+  std::vector<std::string> args(argv+1, argv+argc);
+  if(args.size() < 3) {
+    std::cerr << argv[0] << " usage: compiler-config test-config boost-path [compiler] [file]\n";
+    std::exit(1);
+  }
+  std::string compiler = (args.size() >= 4 ? args[3] : "*");
+    
+  std::list<entry> l;
+  read_compiler_configuration(args[0], std::back_inserter(l));
+  std::string host = get_host();
+  for(std::list<entry>::iterator it = l.begin(); it != l.end(); ) {
+    if(it->os == host && (compiler == "*" || it->identifier == compiler)) {
+      replace_environment(it->command);
+      ++it;
+    } else {
+      it = l.erase(it);
+    }
+  }
+
+  std::string boostpath = args[2];
+
+  if(args.size() >= 5) {
+    std::string cmd = l.front().command;
+    replace(cmd, "%include", boostpath);
+    compile(cmd, boostpath, args[4]);
+    return 0;
+  }
+
+  std::ofstream out( ("cs-" + host + ".html").c_str() );
+
+  out << "<html>\n<head>\n<title>\nCompiler Status: " + host + "\n</title>\n</head>\n"
+      << "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
+      << "<h1><img border border=\"0\" src=\"../c++boost.gif\" width=\"277\" height=\"86\"></h1>\n"
+      << "<h1>Compiler Status: " + host + "</h1>\n"
+      << "</p>\n"
+      << "<p>\n" 
+      << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
+    
+  do_tests(out, l.begin(), l.end(), args[1], boostpath);
+
+  out << "</table>\n";
+  out << "<p>\n"
+      << "2: compile failed<br>\n"
+      << "3: compile succeeded<br>\n"
+      << "4: link failed<br>\n"
+      << "5: link succeeded<br>\n"
+      << "6: run failed<br>\n"
+      << "7: run succeeded<br>\n";
+  return 0;
+}

粤ICP备19079148号