From 88b53da870a9e495fe767f9feebb645db083bf03 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 8 Oct 2013 12:41:27 +0000 Subject: [PATCH] Run second part of test only if it's different from the first. Adjust test output. git-svn-id: https://svn.dealii.org/trunk@31169 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/base/path_search.cc | 34 ++++++++++++++++-------------- tests/base/path_search/cmp/generic | 17 +++++++++++++++ 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/deal.II/source/base/path_search.cc b/deal.II/source/base/path_search.cc index 4f0faa9b8c..eaa59d4ff0 100644 --- a/deal.II/source/base/path_search.cc +++ b/deal.II/source/base/path_search.cc @@ -146,22 +146,24 @@ PathSearch::find (const std::string &filename, } } - // try again with the suffix appended - { - real_name = *path + filename + suffix; - if (debug > 1) - deallog << "PathSearch[" << cls << "] trying " - << real_name << std::endl; - FILE *fp = fopen(real_name.c_str(), open_mode); - if (fp != 0) - { - if (debug > 0) - deallog << "PathSearch[" << cls << "] opened " - << real_name << std::endl; - fclose(fp); - return real_name; - } - } + // try again with the suffix appended, unless there is + // no suffix + if (suffix != "") + { + real_name = *path + filename + suffix; + if (debug > 1) + deallog << "PathSearch[" << cls << "] trying " + << real_name << std::endl; + FILE *fp = fopen(real_name.c_str(), open_mode); + if (fp != 0) + { + if (debug > 0) + deallog << "PathSearch[" << cls << "] opened " + << real_name << std::endl; + fclose(fp); + return real_name; + } + } } AssertThrow(false, ExcFileNotFound(filename, cls)); return std::string(""); diff --git a/tests/base/path_search/cmp/generic b/tests/base/path_search/cmp/generic index fda4b157f3..f7448712a2 100644 --- a/tests/base/path_search/cmp/generic +++ b/tests/base/path_search/cmp/generic @@ -17,8 +17,11 @@ DEAL::PathSearch[CC] trying ../scripts/tests DEAL::PathSearch[CC] trying tests DEAL::PathSearch[CC] trying ../tests DEAL::PathSearch[CC] 3 directories +DEAL::PathSearch[CC] trying ../scripts/tests DEAL::PathSearch[CC] trying ../scripts/tests.h +DEAL::PathSearch[CC] trying tests DEAL::PathSearch[CC] trying tests.h +DEAL::PathSearch[CC] trying ../tests DEAL::PathSearch[CC] trying ../tests.h DEAL::PathSearch[CC] opened ../tests.h DEAL::../tests.h @@ -31,25 +34,39 @@ DEAL::PathSearch[MESH] 2 directories DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.inp +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.inp DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.xda +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.xda DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.dbmesh +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.dbmesh DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.dat +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.dat DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.plt +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.plt DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.nc +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.nc DEAL::PathSearch[MESH] 2 directories +DEAL::PathSearch[MESH] trying grid_in_msh_01.2d DEAL::PathSearch[MESH] trying grid_in_msh_01.2d.msh +DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d DEAL::PathSearch[MESH] trying ../bits/grid_in_msh_01.2d.msh DEAL::PathSearch[MESH] opened ../bits/grid_in_msh_01.2d.msh DEAL:: $NOD 4 1 0 -- 2.39.5