When testing the library we sometimes want to influence data which becomes cached within the library. To allow this we need to reset that cached data to ensure it is re-read from our test data instead of the real system. This change adds the concept of a test probe point to the main library. These are external symbols but not exposed in the standard header, but in libhugetlbfs_testprobe.h. They are also name mangled.
Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]> --- libhugetlbfs_internal.h | 1 + libhugetlbfs_testprobes.h | 35 +++++++++++++++++++++++++++++++++++ tests/hugetests.h | 1 + version.lds | 2 ++ 4 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 libhugetlbfs_testprobes.h diff --git a/libhugetlbfs_internal.h b/libhugetlbfs_internal.h index d8e9e00..6ebe9c0 100644 --- a/libhugetlbfs_internal.h +++ b/libhugetlbfs_internal.h @@ -39,6 +39,7 @@ #endif /* __LIBHUGETLBFS__ */ #include "libhugetlbfs_privutils.h" +#include "libhugetlbfs_testprobes.h" #define stringify_1(x) #x #define stringify(x) stringify_1(x) diff --git a/libhugetlbfs_testprobes.h b/libhugetlbfs_testprobes.h new file mode 100644 index 0000000..2b48227 --- /dev/null +++ b/libhugetlbfs_testprobes.h @@ -0,0 +1,35 @@ +/* + * libhugetlbfs - Easy use of Linux hugepages + * Copyright (C) 2008 IBM Corporation, author: Andy Whitcroft + * + * 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; either version 2.1 of + * the License, or (at your option) any later version. + * + * 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 St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This file should only contain definitions of functions, data types, and + * constants which are part of the internal library test point interfaces. + * These are exposed only to utilities and tests within the source, this is + * not a public interface nor part of the libhugetlfs API. + * + * All functions declared external here must be externalised using a define + * of the following form: + * + * #define foo __tp_foo + */ + +#ifndef _LIBHUGETLBFS_TESTPROBES_H +#define _LIBHUGETLBFS_TESTPROBES_H + +#endif /* _LIBHUGETLBFS_TESTPROBES_H */ diff --git a/tests/hugetests.h b/tests/hugetests.h index 270923b..148895c 100644 --- a/tests/hugetests.h +++ b/tests/hugetests.h @@ -24,6 +24,7 @@ #include <string.h> #include "libhugetlbfs_privutils.h" +#include "libhugetlbfs_testprobes.h" #define DEBUG diff --git a/version.lds b/version.lds index 626ee02..55060b3 100644 --- a/version.lds +++ b/version.lds @@ -4,6 +4,8 @@ VERS_1.0 { hugetlbfs_test_path; hugetlbfs_find_path; hugetlbfs_unlinked_fd; + + __tp_*; local: direct_syscall; __lh_*; -- 1.6.0.2.711.gf1ba4 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel