Răsfoiți Sursa

Separate compile-only and compile-link/run commands
Comments in .cfg files
HTML table Test Type column
VC++ workarounds
Win32 compilers now all work
(Changes not tested on other compilers)


[SVN r8490]

Beman Dawes 25 ani în urmă
părinte
comite
37c63a8ce7
3 a modificat fișierele cu 96 adăugiri și 56 ștergeri
  1. 38 15
      libs/compiler.cfg
  2. 2 0
      libs/regression.cfg
  3. 56 41
      libs/regression.cpp

+ 38 - 15
libs/compiler.cfg

@@ -1,95 +1,118 @@
+// Boost compiler configuration file
+//
+// The first command template is for compile only tests
+// The second command template is for compile and link (and possibly run) tests
+
 linux
 gcc
 GCC 2.95.2
-g++ -ftemplate-depth-30 -I%include %source
+g++ -c -ftemplate-depth-30 -I%include %source
+g++ -o boosttmp.exe -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
+g++ -c -V 2.95.2-stlport -ftemplate-depth-30 -I%include %source
+g++ -o boosttmp.exe -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
+como -c -I%include %source
+como -o boosttmp.exe -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
+CC -c -I%include %source
+CC -o boosttmp.exe -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
+g++ -c -Wall -pedantic -ftemplate-depth-30 -Wno-long-long -I%include %source
+g++ -o boosttmp.exe -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
+KCC -c --strict_warnings -I%include %source
+KCC -o boosttmp.exe --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
+cxx -c -std strict_ansi -D__USE_STD_IOSTREAM -I%include %source
+cxx -o boosttmp.exe -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
+cxx -c -std strict_ansi -D__USE_STD_IOSTREAM -I$HOME/include -I%include %source
+cxx -o boosttmp.exe -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
+CC -c -LANG:std -I%include %source
+CC -o boosttmp.exe -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
+CC -c -LANG:std -I$HOME/include -I%include %source
+CC -o boosttmp.exe -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
+c++ -c -ftemplate-depth-30 -Wall -I%include %source
+c++ -o boosttmp.exe -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
+c++ -c -ftemplate-depth-30 -Wall -I/boot/home/config/stlport/stl330 -I%include %source
+c++ -o boosttmp.exe -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
+bcc32 -c -I%include -j10 -q %source
+bcc32 -eboosttmp.exe -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
+mwcc -c -nocodegen -maxerrors 10 -cwd source -I- -I%include %source
+mwcc -o boosttmp.exe -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
+cl /Feboosttmp.exe /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
+cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "$BOOST_STLPORT_PATH" /I "%include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" %source
+cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "$BOOST_STLPORT_PATH" /I "%include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" %source
 Microsoft<br>VC++<br>6.0 SP4<br>STLport<br>4.0
+
+// end of file

+ 2 - 0
libs/regression.cfg

@@ -1,3 +1,5 @@
+// Boost primary regression test configuration file
+
 compile libs/config/config_test.cpp
 run libs/array/array1.cpp
 compile libs/concept_check/concept_check_test.cpp

+ 56 - 41
libs/regression.cpp

@@ -21,6 +21,11 @@
 #include <fstream>
 #include <utility>
 
+// It is OK to use boost headers which contain entirely inline code.
+#include <boost/config.hpp>
+# ifdef BOOST_NO_STDC_NAMESPACE
+    namespace std { using ::exit; using ::system; }
+# endif
 
 std::string get_host()
 {
@@ -36,7 +41,7 @@ std::string get_host()
 
 struct entry
 {
-  std::string os, identifier, name, command, html;
+  std::string os, identifier, name, compile_only_command, compile_link_command, html;
 };
 
 void replace(std::string & s,
@@ -63,6 +68,14 @@ void replace_environment(std::string & s)
   }
 }
 
+// get a string line, ignoring empty lines and comment lines
+void getstringline( std::ifstream & is, std::string & s )
+{
+  do { std::getline( is, s ); }
+    while ( is.good()
+      && (!s.size() || (s.size() >= 2 && s[0] == '/' && s[1] == '/')) );
+}
+
 template<class OutputIterator>
 void read_compiler_configuration(const std::string & file, OutputIterator out)
 {
@@ -70,11 +83,12 @@ void read_compiler_configuration(const std::string & file, OutputIterator out)
   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);
+    getstringline(f, e.os);
+    getstringline(f, e.identifier);
+    getstringline(f, e.name);
+    getstringline(f, e.compile_only_command);
+    getstringline(f, e.compile_link_command);
+    getstringline(f, e.html);
     *out = e;
     ++out;
     std::string l;
@@ -103,14 +117,14 @@ enum test_result {
 test_result compile(std::string command, const std::string & boostpath,
 	     const std::string & file)
 {
-  replace(command, "%source", "-o boosttmp.o " + boostpath + "/" + file);
+  replace(command, "%source", 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);
+  replace(command, "%source", boostpath + "/" + file);
   return execute(command) ? link_ok : link_failed;
 }
 
@@ -118,7 +132,7 @@ 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);
+  replace(command, "%source", boostpath + "/" + file);
   if(execute(command)) {
     return execute( (get_host() == "win32" ? "" : "./") + exename ) ?
       run_ok : run_failed;
@@ -128,22 +142,24 @@ test_result run(std::string command, const std::string & boostpath,
 }
 
 std::pair<test_result, test_result>
-run_test(const std::string & type, std::string command,
+run_test(const std::string & type, std::string compile_only_command,
+   std::string compile_link_command,
 	 const std::string & boostpath, const std::string & source)
 {
-  replace(command, "%include", boostpath);
+  replace(compile_only_command, "%include", boostpath);
+  replace(compile_link_command, "%include", boostpath);
   if(type == "compile")
-    return std::make_pair(compile(command, boostpath, source), compile_ok);
+    return std::make_pair(compile(compile_only_command, boostpath, source), compile_ok);
   else if(type == "compile-fail")
-    return std::make_pair(compile(command, boostpath, source), compile_failed);
+    return std::make_pair(compile(compile_only_command, boostpath, source), compile_failed);
   else if(type == "link")
-    return std::make_pair(link(command, boostpath, source), link_ok);
+    return std::make_pair(link(compile_link_command, boostpath, source), link_ok);
   else if(type == "link-fail")
-    return std::make_pair(link(command, boostpath, source), link_failed);
+    return std::make_pair(link(compile_link_command, boostpath, source), link_failed);
   else if(type == "run")
-    return std::make_pair(run(command, boostpath, source), run_ok);
+    return std::make_pair(run(compile_link_command, boostpath, source), run_ok);
   else if(type == "run-fail")
-    return std::make_pair(run(command, boostpath, source), run_failed);
+    return std::make_pair(run(compile_link_command, boostpath, source), run_failed);
   else
     return std::make_pair(unknown_type, ok);
 }
@@ -154,7 +170,8 @@ void do_tests(std::ostream & out,
 	      const std::string & testconfig, const std::string & boostpath)
 {
   out << "<tr>\n"
-      << "<td>Program</td>\n";
+      << "<td>Program</td>\n"
+      << "<td>Test<br>Type</td>\n";
   for(ForwardIterator it = firstcompiler; it != lastcompiler; ++it) {
     out << "<td>" << it->html << "</td>\n";
   }
@@ -163,7 +180,7 @@ void do_tests(std::ostream & out,
   std::ifstream f(testconfig.c_str());
   while(f.good()) {
     std::string l;
-    std::getline(f, l);
+    getstringline(f, l);
     typedef std::string::size_type sz_type;
     sz_type p = l.find(' ');
     if(p == std::string::npos) {
@@ -171,28 +188,26 @@ void do_tests(std::ostream & out,
       continue;
     }
     std::string type(l, 0, p);
-    std::string file(l, p+1);
+    std::string file(l, p+1, std::string::npos);  // 3rd arg to fix VC++ bug
 
-    std::cout << file << "\n";
+    std::cout << "*** " << file << " ***\n\n";
 
     out << "<tr>\n"
-	<< "<td><a href=\"" << file << "\">" << file << "</a></td>\n";
+        << "<td><a href=\"" << file << "\">" << file << "</a></td>\n"
+        << "<td>" << type << "</td>\n";
 
     for(ForwardIterator it = firstcompiler; it != lastcompiler; ++it) {
-      std::cout << "\t" << it->name << std::endl;
+      std::cout << "** " << it->name << std::endl;
       std::pair<test_result, test_result> result =
-	run_test(type, it->command, boostpath, file);
+	run_test(type, it->compile_only_command, it->compile_link_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 << "<td>"
+          << (result.first == result.second ? "Pass" : "<font color=\"#FF0000\">Fail</font>")
+          << "</td>" << std::endl;
+      std::cout << (result.first == result.second ? "Pass" : "Fail") << "\n\n";
     }
     out << "</tr>\n";
   }
@@ -201,7 +216,13 @@ void do_tests(std::ostream & out,
 
 int main(int argc, char * argv[])
 {
-  std::vector<std::string> args(argv+1, argv+argc);
+//  std::vector<std::string> args(argv+1, argv+argc);
+// hack around VC++ lack of ctor taking iterator args
+  std::vector<std::string> args;
+  for ( const char ** ait = (const char **)(argv+1);
+        ait != (const char **)(argv+argc); ++ait)
+    args.push_back(std::string( *ait ));
+
   if(args.size() < 3) {
     std::cerr << argv[0] << " usage: compiler-config test-config boost-path [compiler] [file]\n";
     std::exit(1);
@@ -213,7 +234,8 @@ int main(int argc, char * argv[])
   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);
+      replace_environment(it->compile_only_command);
+      replace_environment(it->compile_link_command);
       ++it;
     } else {
       it = l.erase(it);
@@ -223,7 +245,7 @@ int main(int argc, char * argv[])
   std::string boostpath = args[2];
 
   if(args.size() >= 5) {
-    std::string cmd = l.front().command;
+    std::string cmd = l.front().compile_only_command;
     replace(cmd, "%include", boostpath);
     compile(cmd, boostpath, args[4]);
     return 0;
@@ -242,12 +264,5 @@ int main(int argc, char * argv[])
   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号