Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for valgrind-friendly memory fetch.
- Loading branch information
Dmitry Prokoptsev
committed
Nov 6, 2013
1 parent
529584b
commit e53b982
Showing
4 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
libtool --mode=execute valgrind ./pire_test_valgrind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* valgrind_ut.cpp -- tests for Pire compatibility with Valgrind | ||
* | ||
* Copyright (c) 2007-2010, Dmitry Prokoptsev <dprokoptsev@gmail.com>, | ||
* Alexander Gololobov <agololobov@gmail.com> | ||
* | ||
* This file is part of Pire, the Perl Incompatible | ||
* Regular Expressions library. | ||
* | ||
* Pire is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Pire 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 Public License for more details. | ||
* You should have received a copy of the GNU Lesser Public License | ||
* along with Pire. If not, see <http://www.gnu.org/licenses>. | ||
*/ | ||
|
||
#ifndef PIRE_ENABLE_VALGRIND_SAFE | ||
#define PIRE_ENABLE_VALGRIND_SAFE | ||
#endif | ||
|
||
#include <stub/hacks.h> | ||
#include <stub/defaults.h> | ||
#include "stub/cppunit.h" | ||
#include <stdexcept> | ||
#include "common.h" | ||
|
||
SIMPLE_UNIT_TEST_SUITE(TestPireValgrind) { | ||
|
||
SIMPLE_UNIT_TEST(Valgrind) | ||
{ | ||
char* str = (char*) malloc(6); | ||
try { | ||
strcpy(str, "abcde"); | ||
REGEXP("abcde") ACCEPTS(str); | ||
free(str); | ||
} | ||
catch (...) { | ||
free(str); | ||
throw; | ||
} | ||
} | ||
|
||
} |