Allow tests to suppress deprecation warnings

This prevents certain tests from failing comparisons with blessed output files.
This commit is contained in:
Ray Speth 2013-06-05 17:09:46 +00:00
parent 56d481785c
commit 2483e39ae5
7 changed files with 19 additions and 2 deletions

View file

@ -180,6 +180,9 @@ void error(const std::string& msg);
//! @copydoc Application::warn_deprecated
void warn_deprecated(const std::string& method, const std::string& extra="");
//! @copydoc Application::suppress_deprecation_warnings
void suppress_deprecation_warnings();
//! @copydoc Application::Messages::setLogger
void setLogger(Logger* logwriter);

View file

@ -321,6 +321,7 @@ Application::Application() :
stop_on_error(false),
options(),
xmlfiles(),
m_suppress_deprecation_warnings(false),
pMessenger()
{
#if !defined( THREAD_SAFE_CANTERA )
@ -373,7 +374,7 @@ void Application::ApplicationDestroy()
void Application::warn_deprecated(const std::string& method,
const std::string& extra)
{
if (warnings.count(method)) {
if (m_suppress_deprecation_warnings || warnings.count(method)) {
return;
}
warnings.insert(method);

View file

@ -446,6 +446,10 @@ public:
//! invocation of the application.
void warn_deprecated(const std::string& method, const std::string& extra="");
void suppress_deprecation_warnings() {
m_suppress_deprecation_warnings = true;
}
//! @copydoc Messages::setLogger
void setLogger(Logger* logwriter) {
pMessenger->setLogger(logwriter);
@ -549,6 +553,8 @@ protected:
//! Vector of deprecation warnings that have been emitted (to suppress duplicates)
std::set<std::string> warnings;
bool m_suppress_deprecation_warnings;
//! Current pointer to the logwriter
//Logger* logwriter;
#ifdef WITH_HTML_LOGS

View file

@ -77,6 +77,11 @@ void warn_deprecated(const std::string& method, const std::string& extra)
app()->warn_deprecated(method, extra);
}
void suppress_deprecation_warnings()
{
app()->suppress_deprecation_warnings();
}
// **************** HTML Logging ****************
#ifdef WITH_HTML_LOGS

View file

@ -15,7 +15,7 @@ int main(int argc, char** argv)
ChemEquil_print_lvl = 0;
#endif
try {
suppress_deprecation_warnings();
IdealGasPhase* gas = new IdealGasMix("air_below6000K.xml","air_below6000K");
vector_fp IndVar2(6, 0.0);

View file

@ -11,6 +11,7 @@ using namespace Cantera;
void testProblem()
{
suppress_deprecation_warnings();
double T = 273.15 + 352.0;
VCSnonideal::vcs_timing_print_lvl = 0;

View file

@ -30,6 +30,7 @@ int main(int argc, char** argv)
#ifdef _MSC_VER
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
suppress_deprecation_warnings();
// int solver = 2;
int numSucc = 0;
int numFail = 0;