diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2016-08-29 18:48:47 +0000 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2016-08-29 18:48:47 +0000 |
commit | 0c2442eb684a060d5582c154c95cb995a64ae70c (patch) | |
tree | 5df935129546a58a21a9daa4d9e82a00269cc412 /indra/llcommon/tests | |
parent | 4c41b1d8ac041834b37fbd956f646749ac4c0325 (diff) |
MAINT-5011: Fix abbreviateFile() test to run under .../indra/ path.
This particular test relied on there being exactly one instance of the string
"indra" in the source file's __FILE__ path -- which is usually true, but not
if the developer clones the viewer source repo under a parent directory whose
path itself contains "indra". Fix to handle any number of occurrences.
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r-- | indra/llcommon/tests/llerror_test.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index f51279e817..8bace8ac41 100644 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -237,8 +237,21 @@ namespace tut void ErrorTestObject::test<4>() // file abbreviation { - std::string thisFile = __FILE__; - std::string abbreviateFile = LLError::abbreviateFile(thisFile); + std::string prev, abbreviateFile = __FILE__; + do + { + prev = abbreviateFile; + abbreviateFile = LLError::abbreviateFile(abbreviateFile); + // __FILE__ is assumed to end with + // indra/llcommon/tests/llerror_test.cpp. This test used to call + // abbreviateFile() exactly once, then check below whether it + // still contained the string 'indra'. That fails if the FIRST + // part of the pathname also contains indra! Certain developer + // machine images put local directory trees under + // /ngi-persist/indra, which is where we observe the problem. So + // now, keep calling abbreviateFile() until it returns its + // argument unchanged, THEN check. + } while (abbreviateFile != prev); ensure_ends_with("file name abbreviation", abbreviateFile, |