From f86a488231dc9a629d44a9f6aa6bfc9aa0eb57b4 Mon Sep 17 00:00:00 2001 From: Squire Date: Fri, 17 Jun 2011 11:05:31 -0700 Subject: CHOP-662 - initial fix to problems with regex characters in Group names causing the LLDirIterator to crash the viewer when opening chat logs --- indra/llvfs/tests/lldiriterator_test.cpp | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 indra/llvfs/tests/lldiriterator_test.cpp (limited to 'indra/llvfs/tests') diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp new file mode 100644 index 0000000000..7c2cd49e41 --- /dev/null +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -0,0 +1,62 @@ +/** + * @file lldiriterator_test.cpp + * @date 2011-06 + * @brief LLDirIterator test cases. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only., + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "lltut.h" +#include "../lldiriterator.h" + + +namespace tut +{ + + struct LLDirIteratorFixture + { + LLDirIteratorFixture() + { + } + }; + typedef test_group LLDirIteratorTest_factory; + typedef LLDirIteratorTest_factory::object LLDirIteratorTest_t; + LLDirIteratorTest_factory tf("LLDirIterator"); + + /* + CHOP-662 was originally introduced to deal with crashes deleting files from + a directory (VWR-25500). However, this introduced a crash looking for + old chat logs as the glob_to_regex function in lldiriterator wasn't escaping lots of regexp characters + */ + void test_chop_662(void) + { + LLDirIterator iter(".","+bad-group-name]+??-??.*"); + } + + template<> template<> + void LLDirIteratorTest_t::test<1>() + { + test_chop_662(); + } + +} \ No newline at end of file -- cgit v1.2.3 From 29f1b466e66fd5a98926ac7318287c22f74e32bf Mon Sep 17 00:00:00 2001 From: Squire Date: Fri, 17 Jun 2011 14:13:01 -0700 Subject: COP-662 Added newline at end of file for Linux build --- indra/llvfs/tests/lldiriterator_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llvfs/tests') diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp index 7c2cd49e41..0e7017f59f 100644 --- a/indra/llvfs/tests/lldiriterator_test.cpp +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -59,4 +59,4 @@ namespace tut test_chop_662(); } -} \ No newline at end of file +} -- cgit v1.2.3 From 306759835d8aed3a041a59dafaa20a8c708e2dd4 Mon Sep 17 00:00:00 2001 From: Squire Date: Mon, 20 Jun 2011 11:07:17 -0700 Subject: Added more tests to cover the common examples in the crash logs --- indra/llvfs/tests/lldiriterator_test.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llvfs/tests') diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp index 0e7017f59f..aacc5a616a 100644 --- a/indra/llvfs/tests/lldiriterator_test.cpp +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -50,7 +50,10 @@ namespace tut */ void test_chop_662(void) { + // Check a selection of bad group names from the crash reports LLDirIterator iter(".","+bad-group-name]+??-??.*"); + LLDirIterator iter(".","))--@---bad-group-name2((??-??.*\.txt"); + LLDirIterator iter(".","__^v--x)Cuide d sua vida(x--v^__??-??.*"); } template<> template<> -- cgit v1.2.3 From f02dc7e1b6c26d897628617a870f250004febee0 Mon Sep 17 00:00:00 2001 From: Squire Date: Mon, 20 Jun 2011 12:17:25 -0700 Subject: CHOP-662 Coupl of fixes to extended unit-test --- indra/llvfs/tests/lldiriterator_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llvfs/tests') diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp index aacc5a616a..505d86faa7 100644 --- a/indra/llvfs/tests/lldiriterator_test.cpp +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -52,8 +52,8 @@ namespace tut { // Check a selection of bad group names from the crash reports LLDirIterator iter(".","+bad-group-name]+??-??.*"); - LLDirIterator iter(".","))--@---bad-group-name2((??-??.*\.txt"); - LLDirIterator iter(".","__^v--x)Cuide d sua vida(x--v^__??-??.*"); + LLDirIterator iter1(".","))--@---bad-group-name2((??-??.*\\.txt"); + LLDirIterator iter2(".","__^v--x)Cuide d sua vida(x--v^__??-??.*"); } template<> template<> -- cgit v1.2.3