Update of /cvsroot/compbench/CompBenchmarks++/Benchmark
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28658
Modified Files:
Benchmark.cpp Benchmark.h
Log Message:
Items for package testing (once built, and before benchmarking).
Index: Benchmark.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/Benchmark/Benchmark.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Benchmark.h 24 Sep 2006 16:30:00 -0000 1.5
--- Benchmark.h 3 Oct 2006 15:47:54 -0000 1.6
***************
*** 42,45 ****
--- 42,46 ----
Configured, /*!< Package is configured (./configure) */
Made, /*!< Package has been made (make) */
+ Tested, /*!< Package has been tested */
Benchmarked }; /*!< Benchmarked */
***************
*** 162,165 ****
--- 163,181 ----
virtual int patch(int _force = 0);
+
+ /** Indicates if the package provides a test method.
+ * Must be overloaded if so. Returns 0 by default.
+ * \return 0 by default, 1 if patch is needed.
+ * \sa test()
+ * \sa Test()
+ */
+ virtual int hasTest(void);
+
+ /** Method to test package.
+ * Must be overloaded to test package using a method provided by package
+ * maintainers.
+ * \sa Test() */
+ virtual int test(int _force = 0);
+
/** Pure virtual method to pre-configure package
* Pre-configuration creates any needed elements (files or what ever) to benchmark
***************
*** 269,273 ****
/** Patch package.
* Patches extracted package.
! * Overloading is unadvised, 1 is returned without any action by default.
* If hasPatch() returns 1, uses patch().
* This step won't be done and'll return 1 if getStatus()>=CBMPackage::Patched.
--- 285,289 ----
/** Patch package.
* Patches extracted package.
! * Overloading is unadvised, 1 is returned without any action, by default.
* If hasPatch() returns 1, uses patch().
* This step won't be done and'll return 1 if getStatus()>=CBMPackage::Patched.
***************
*** 313,316 ****
--- 329,344 ----
virtual int Make(void);
+ /** Test a package.
+ * Test a built package.
+ * Overloading is unadvised, 1 is returned without any action, by default.
+ * If hasPatch() returns 1, uses patch().
+ * This step won't be done and'll return 1 if getStatus()>=CBMPackage::Benchmarked.
+ * \param _force sets to 1 to force operation. May changes status.
+ * \return 1 if ok.
+ * \sa Make()
+ * \sa status */
+ virtual int Test(int _force = 0);
+
+
/** Run benchmarks.
* Uses bench(). Overloading is unadvised.
Index: Benchmark.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/Benchmark/Benchmark.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Benchmark.cpp 2 Oct 2006 19:17:11 -0000 1.10
--- Benchmark.cpp 3 Oct 2006 15:47:54 -0000 1.11
***************
*** 70,73 ****
--- 70,83 ----
}
+ int CBMBenchmark::hasTest(void)
+ {
+ return(0);
+ }
+
+ int CBMBenchmark::test(int _force)
+ {
+ return(1);
+ }
+
int CBMBenchmark::uninstall(void)
***************
*** 343,346 ****
--- 353,369 ----
}
+ if (language()!=_currentCompiler->language()) {
+
+ storeContext(_currentCompiler,
+ _currentOptions);
+ info=_currentCompiler->Binary();
+ info+=" is a ";
+ info+=_currentCompiler->language();
+ info+=" compiler, while benchmark is written is ";
+ info+=language();
+ info+=".";
+ UI->Fatal(info);
+ }
+
UI->Information(CBMUI::BenchConfigure,
info);
***************
*** 390,393 ****
--- 413,449 ----
}
+ int CBMBenchmark::Test(int _force)
+ {
+ int r;
+
+ if (!hasTest())
+ return(1);
+
+ if ((!_force) &&
+ (getStatus()>=Benchmarked)) {
+ return(1);
+ }
+
+ if (getStatus()<Made) {
+ return(0);
+ }
+
+ UI->Information(CBMUI::BenchTest,
+ packageName());
+
+ r=test(_force);
+
+ if (r)
+ storeStatus(Tested);
+ else {
+ std::string info;
+ info="Error testing ";
+ info+=localPackageAbsoluteName();
+ UI->Fatal(info);
+ }
+
+ return(r);
+ }
+
std::string CBMBenchmark::Bench(void)
{
***************
*** 395,398 ****
--- 451,464 ----
std::string info;
+
+ if ((getStatus()!=Tested) && (hasTest())) {
+ info=benchmarkName();
+ info+=" not tested !";
+ UI->Information(CBMUI::BenchTest,
+ info);
+
+ return("0");
+ }
+
UI->Information(CBMUI::BenchBench,
benchmarkName());
***************
*** 481,485 ****
if (expected_md5==md5) {
UI->Information(CBMUI::ChecksumOK,
! localFile);
storeStatus(Downloaded);
--- 547,551 ----
if (expected_md5==md5) {
UI->Information(CBMUI::ChecksumOK,
! dest);
storeStatus(Downloaded);
***************
*** 487,491 ****
} else {
UI->Information(CBMUI::ChecksumFailed,
! localFile);
}
}
--- 553,557 ----
} else {
UI->Information(CBMUI::ChecksumFailed,
! dest);
}
}
|