From 01c165cd1b2ac601d5ae73d3cb5e82ccdd94ac94 Mon Sep 17 00:00:00 2001 From: Le Chi Thu Date: Tue, 3 Apr 2012 01:23:00 +0200 Subject: Initial commit --- ltp_framework/include/Makefile | 45 +++ ltp_framework/include/cleanup.c | 45 +++ ltp_framework/include/compiler.h | 18 ++ ltp_framework/include/config.h | 293 +++++++++++++++++++ ltp_framework/include/config.h.default | 251 ++++++++++++++++ ltp_framework/include/config.h.in | 292 +++++++++++++++++++ ltp_framework/include/dataascii.h | 65 +++++ ltp_framework/include/databin.h | 44 +++ ltp_framework/include/file_lock.h | 46 +++ ltp_framework/include/forker.h | 63 ++++ ltp_framework/include/libtestsuite.h | 20 ++ ltp_framework/include/ltp_signal.h | 109 +++++++ ltp_framework/include/mk/automake.mk | 117 ++++++++ ltp_framework/include/mk/config.mk | 82 ++++++ ltp_framework/include/mk/config.mk.default | 76 +++++ ltp_framework/include/mk/config.mk.in | 82 ++++++ ltp_framework/include/mk/env_post.mk | 104 +++++++ ltp_framework/include/mk/env_pre.mk | 144 +++++++++ ltp_framework/include/mk/features.mk | 55 ++++ ltp_framework/include/mk/features.mk.default | 55 ++++ ltp_framework/include/mk/features.mk.in | 55 ++++ ltp_framework/include/mk/functions.mk | 76 +++++ ltp_framework/include/mk/generic_leaf_target.inc | 106 +++++++ ltp_framework/include/mk/generic_leaf_target.mk | 24 ++ ltp_framework/include/mk/generic_trunk_target.inc | 97 +++++++ ltp_framework/include/mk/generic_trunk_target.mk | 24 ++ ltp_framework/include/mk/gitignore.mk | 51 ++++ ltp_framework/include/mk/lib.mk | 64 ++++ ltp_framework/include/mk/man.mk | 37 +++ ltp_framework/include/mk/testcases.mk | 55 ++++ ltp_framework/include/open_flags.h | 73 +++++ ltp_framework/include/pattern.h | 90 ++++++ ltp_framework/include/random_range.h | 45 +++ ltp_framework/include/rmobj.h | 12 + ltp_framework/include/safe_macros.h | 139 +++++++++ ltp_framework/include/search_path.h | 36 +++ ltp_framework/include/stamp-h1 | 1 + ltp_framework/include/str_to_bytes.h | 39 +++ ltp_framework/include/string_to_tokens.h | 48 +++ ltp_framework/include/swaponoff.h | 18 ++ .../include/system_specific_hugepages_info.h | 30 ++ .../include/system_specific_process_info.h | 29 ++ ltp_framework/include/test.h | 253 ++++++++++++++++ ltp_framework/include/tlibio.h | 161 ++++++++++ ltp_framework/include/usctest.h | 323 +++++++++++++++++++++ ltp_framework/include/write_log.h | 170 +++++++++++ 46 files changed, 4062 insertions(+) create mode 100644 ltp_framework/include/Makefile create mode 100644 ltp_framework/include/cleanup.c create mode 100644 ltp_framework/include/compiler.h create mode 100644 ltp_framework/include/config.h create mode 100644 ltp_framework/include/config.h.default create mode 100644 ltp_framework/include/config.h.in create mode 100644 ltp_framework/include/dataascii.h create mode 100644 ltp_framework/include/databin.h create mode 100644 ltp_framework/include/file_lock.h create mode 100644 ltp_framework/include/forker.h create mode 100644 ltp_framework/include/libtestsuite.h create mode 100644 ltp_framework/include/ltp_signal.h create mode 100644 ltp_framework/include/mk/automake.mk create mode 100644 ltp_framework/include/mk/config.mk create mode 100644 ltp_framework/include/mk/config.mk.default create mode 100644 ltp_framework/include/mk/config.mk.in create mode 100644 ltp_framework/include/mk/env_post.mk create mode 100644 ltp_framework/include/mk/env_pre.mk create mode 100644 ltp_framework/include/mk/features.mk create mode 100644 ltp_framework/include/mk/features.mk.default create mode 100644 ltp_framework/include/mk/features.mk.in create mode 100644 ltp_framework/include/mk/functions.mk create mode 100644 ltp_framework/include/mk/generic_leaf_target.inc create mode 100644 ltp_framework/include/mk/generic_leaf_target.mk create mode 100644 ltp_framework/include/mk/generic_trunk_target.inc create mode 100644 ltp_framework/include/mk/generic_trunk_target.mk create mode 100644 ltp_framework/include/mk/gitignore.mk create mode 100644 ltp_framework/include/mk/lib.mk create mode 100644 ltp_framework/include/mk/man.mk create mode 100644 ltp_framework/include/mk/testcases.mk create mode 100644 ltp_framework/include/open_flags.h create mode 100644 ltp_framework/include/pattern.h create mode 100644 ltp_framework/include/random_range.h create mode 100644 ltp_framework/include/rmobj.h create mode 100644 ltp_framework/include/safe_macros.h create mode 100644 ltp_framework/include/search_path.h create mode 100644 ltp_framework/include/stamp-h1 create mode 100644 ltp_framework/include/str_to_bytes.h create mode 100644 ltp_framework/include/string_to_tokens.h create mode 100644 ltp_framework/include/swaponoff.h create mode 100644 ltp_framework/include/system_specific_hugepages_info.h create mode 100644 ltp_framework/include/system_specific_process_info.h create mode 100644 ltp_framework/include/test.h create mode 100644 ltp_framework/include/tlibio.h create mode 100644 ltp_framework/include/usctest.h create mode 100644 ltp_framework/include/write_log.h (limited to 'ltp_framework/include') diff --git a/ltp_framework/include/Makefile b/ltp_framework/include/Makefile new file mode 100644 index 0000000..243fd8a --- /dev/null +++ b/ltp_framework/include/Makefile @@ -0,0 +1,45 @@ +# +# include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +top_srcdir ?= .. + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(includedir) + +INSTALL_MODE := 00644 + +INSTALL_TARGETS := *.h + +MAKE_TARGETS := + +.PHONY: ac-clean ac-distclean ac-maintainer-clean distclean maintainer-clean +distclean:: clean ac-distclean +maintainer-clean:: distclean ac-maintainer-clean +ac-clean ac-distclean:: + $(RM) -f config.h +ac-maintainer-clean:: + $(RM) -f config.h.in + +vpath %.h $(abs_srcdir) + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/ltp_framework/include/cleanup.c b/ltp_framework/include/cleanup.c new file mode 100644 index 0000000..31393fd --- /dev/null +++ b/ltp_framework/include/cleanup.c @@ -0,0 +1,45 @@ +/* + * Default cleanup logic because linux_syscall_numbers.h's need for cleanup + * and binutils bugs suck. + * + * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + */ + +#ifndef __CLEANUP_C__ +#define __CLEANUP_C__ + +/* Did the user define a cleanup function? */ +#ifndef CLEANUP +# define USING_DUMMY_CLEANUP 1 +# define CLEANUP dummy_cleanup +#endif + +/* A freebie for defining the function prototype. */ +static void CLEANUP(void) __attribute__((unused)); + +#ifdef USING_DUMMY_CLEANUP +/* The stub function. Wewt.. */ +static void dummy_cleanup(void) { } +#endif + +#endif diff --git a/ltp_framework/include/compiler.h b/ltp_framework/include/compiler.h new file mode 100644 index 0000000..ec714fe --- /dev/null +++ b/ltp_framework/include/compiler.h @@ -0,0 +1,18 @@ +/* + * compiler.h: take care of fun compiler details here + * + * Licensed under the GPL-2 or later + */ + +#ifndef __LTP_COMPILER_H__ +#define __LTP_COMPILER_H__ + +#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#define LTP_ATTRIBUTE_UNUSED __attribute__((unused)) +#define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result)) + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +#endif + +#endif /* __LTP_COMPILER_H__ */ diff --git a/ltp_framework/include/config.h b/ltp_framework/include/config.h new file mode 100644 index 0000000..174c6ad --- /dev/null +++ b/ltp_framework/include/config.h @@ -0,0 +1,293 @@ +/* include/config.h. Generated from config.h.in by configure. */ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ASM_LDT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_PTRACE_H 1 + +/* Define to 1 if you have the `daemon' function. */ +#define HAVE_DAEMON 1 + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_COARSE', and to + 0 if you don't. */ +#define HAVE_DECL_CLOCK_MONOTONIC_COARSE 1 + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_RAW', and to 0 + if you don't. */ +#define HAVE_DECL_CLOCK_MONOTONIC_RAW 1 + +/* Define to 1 if you have the declaration of `CLOCK_REALTIME_COARSE', and to + 0 if you don't. */ +#define HAVE_DECL_CLOCK_REALTIME_COARSE 1 + +/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if + you don't. */ +#define HAVE_DECL_MADV_MERGEABLE 1 + +/* Define to 1 if you have the declaration of `MPOL_BIND', and to 0 if you + don't. */ +#define HAVE_DECL_MPOL_BIND 0 + +/* Define to 1 if you have the declaration of `MPOL_DEFAULT', and to 0 if you + don't. */ +#define HAVE_DECL_MPOL_DEFAULT 0 + +/* Define to 1 if you have the declaration of `MPOL_F_ADDR', and to 0 if you + don't. */ +#define HAVE_DECL_MPOL_F_ADDR 0 + +/* Define to 1 if you have the declaration of `MPOL_F_MEMS_ALLOWED', and to 0 + if you don't. */ +#define HAVE_DECL_MPOL_F_MEMS_ALLOWED 0 + +/* Define to 1 if you have the declaration of `MPOL_F_NODE', and to 0 if you + don't. */ +#define HAVE_DECL_MPOL_F_NODE 0 + +/* Define to 1 if you have the declaration of `MPOL_INTERLEAVE', and to 0 if + you don't. */ +#define HAVE_DECL_MPOL_INTERLEAVE 0 + +/* Define to 1 if you have the declaration of `MPOL_PREFERRED', and to 0 if + you don't. */ +#define HAVE_DECL_MPOL_PREFERRED 0 + +/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if + you don't. */ +#define HAVE_DECL_PR_CAPBSET_DROP 1 + +/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if + you don't. */ +#define HAVE_DECL_PR_CAPBSET_READ 1 + +/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if + you don't. */ +#define HAVE_DECL_PTRACE_GETSIGINFO 1 + +/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and + to 0 if you don't. */ +#define HAVE_DECL_PTRACE_O_TRACEVFORKDONE 1 + +/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if + you don't. */ +#define HAVE_DECL_PTRACE_SETOPTIONS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DMAPI_H */ + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `io_set_eventfd' function. */ +/* #undef HAVE_IO_SET_EVENTFD */ + +/* Define to 1 if you have the libkeyutils development package and keyctl + syscall on your system */ +#define HAVE_KEYCTL_SYSCALL 0 + +/* Define to 1 if you have libacl installed. */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBAIO_H */ + +/* Define to 1 if you have libcap-2 installed. */ +/* #undef HAVE_LIBCAP */ + +/* Define to 1 if you have both SELinux libraries and headers. */ +/* #undef HAVE_LIBSELINUX_DEVEL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_GENETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MEMPOLICY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MODULE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_NETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_PTRACE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SECUREBITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SIGNALFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TASKSTATS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have MADV_MERGEABLE */ +#define HAVE_MADV_MERGEABLE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MM_H */ + +/* Define to 1 if you have the `modify_ldt' function. */ +/* #undef HAVE_MODIFY_LDT */ + +/* define to 1 if you have all constants required to use mbind tests */ +/* #undef HAVE_MPOL_CONSTANTS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NUMAIF_H */ + +/* Define to 1 if you have the `numa_alloc_onnode' function. */ +/* #undef HAVE_NUMA_ALLOC_ONNODE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NUMA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_SHA_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have quota v1 */ +/* #undef HAVE_QUOTAV1 */ + +/* Define to 1 if you have quota v2 */ +#define HAVE_QUOTAV2 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SELINUX_SELINUX_H */ + +/* Define to 1 if you have the `signalfd' function. */ +#define HAVE_SIGNALFD 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SIGNALFD_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ +/* #undef HAVE_STRUCT_MODIFY_LDT_LDT_S */ + +/* Define to 1 if the system has the type `struct pt_regs'. */ +#define HAVE_STRUCT_PT_REGS 1 + +/* Define to 1 if `sa_sigaction' is member of `struct sigaction'. */ +#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1 + +/* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */ +/* #undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO */ + +/* Define to 1 if `ssi_signo' is member of `struct signalfd_siginfo'. */ +#define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1 + +/* Define to 1 if `freepages_count' is member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT 1 + +/* Define to 1 if `nvcsw' is member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_NVCSW 1 + +/* Define to 1 if `read_bytes' is member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_READ_BYTES 1 + +/* Define to 1 if the system has the type `struct user_desc'. */ +/* #undef HAVE_STRUCT_USER_DESC */ + +/* Define to 1 if the system has the type `struct user_regs_struct'. */ +/* #undef HAVE_STRUCT_USER_REGS_STRUCT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CAPABILITY_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_EPOLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_INOTIFY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_JFSDMAPI_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PTRACE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_REG_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SIGNALFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unshare' function. */ +#define HAVE_UNSHARE 1 + +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Name of package */ +#define PACKAGE "ltp" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "ltp-list@lists.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "ltp" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ltp LTP_VERSION" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "ltp" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "LTP_VERSION" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Target is running Linux w/out an MMU */ +/* #undef UCLINUX */ + +/* Version number of package */ +#define VERSION "LTP_VERSION" + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +/* #undef YYTEXT_POINTER */ diff --git a/ltp_framework/include/config.h.default b/ltp_framework/include/config.h.default new file mode 100644 index 0000000..15ff210 --- /dev/null +++ b/ltp_framework/include/config.h.default @@ -0,0 +1,251 @@ +/* include/config.h.default. + A semi-sane set of defaults for more recent Linux platforms. Please tailor + to meet your needs. + */ + +/* Define to 1 if you have the new implementation of quotactl that only + requires sys/types.h and sys/quota.h */ +#define HAS_NEW_MINIMAL_QUOTACTL 1 + +/* Define to 1 if you have the RHEL ~4.6 version of quotactl, e.g. require + linux/quota.h instead of sys/quota.h */ +#undef HAS_RHEL46_QUOTACTL + +/* Define to 1 if you have the RHEL 4.8+ version of quotactl, e.g. require + sys/quota.h */ +#define HAS_RHEL48_QUOTACTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_LDT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ATTR_XATTR_H + +/* Define to 1 if you have the declaration of `CAP_BSET_DROP', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_BSET_DROP + +/* Define to 1 if you have the declaration of `CAP_BSET_READ', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_BSET_READ + +/* Define to 1 if you have the declaration of `cap_compare', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_COMPARE + +/* Define to 1 if you have the declaration of `cap_free', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_FREE + +/* Define to 1 if you have the declaration of `cap_from_text', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_FROM_TEXT + +/* Define to 1 if you have the declaration of `cap_get_proc', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_GET_PROC + +/* Define to 1 if you have the declaration of `cap_set_file', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_SET_FILE + +/* Define to 1 if you have the declaration of `cap_set_flag', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_SET_FLAG + +/* Define to 1 if you have the declaration of `cap_set_proc', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_SET_PROC + +/* Define to 1 if you have the declaration of `cap_to_text', and to 0 if you + don't. */ +#undef HAVE_DECL_CAP_TO_TEXT + +/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if + you don't. */ +#undef HAVE_DECL_PR_CAPBSET_READ + +/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if + you don't. */ +#define HAVE_DECL_PTRACE_GETSIGINFO 1 + +/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and + to 0 if you don't. */ +#define HAVE_DECL_PTRACE_O_TRACEVFORKDONE 1 + +/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if + you don't. */ +#undef HAVE_DECL_PTRACE_SETOPTIONS + +/* Define to 1 if you have the header file. */ +#undef HAVE_DMAPI_H + +/* Define to 1 if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `io_set_eventfd' function. */ +#undef HAVE_IO_SET_EVENTFD + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAIO_H + +/* Define to 1 if you have both SELinux libraries and headers. */ +#undef HAVE_LIBSELINUX_DEVEL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_GENETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MODULE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_NETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_PTRACE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TASKSTATS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MM_H + +/* Define to 1 if you have the `modify_ldt' function. */ +#undef HAVE_MODIFY_LDT + +/* 2.6 version of swapon/swapoff */ +#define HAVE_NEW_SWAPONOFF 1 + +/* Define to 1 if you have the `numa_alloc_onnode' function. */ +#undef HAVE_NUMA_ALLOC_ONNODE + +/* Define to 1 if you have the header file. */ +#undef HAVE_NUMA_H + +/* 2.4 version of swapon/swapoff */ +#undef HAVE_OLD_SWAPONOFF + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SHA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SELINUX_SELINUX_H + +/* Define to 1 if you have the `signalfd' function. */ +#define HAVE_SIGNALFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNALFD_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ +#undef HAVE_STRUCT_MODIFY_LDT_LDT_S + +/* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */ +#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO + +/* Define to 1 if `ssi_signo' is member of `struct signalfd_siginfo'. */ +#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO + +/* Define to 1 if `freepages_count' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT + +/* Define to 1 if `nvcsw' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_NVCSW + +/* Define to 1 if `read_bytes' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_READ_BYTES + +/* Define to 1 if the system has the type `struct user_desc'. */ +#undef HAVE_STRUCT_USER_DESC + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_ACL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_CAPABILITY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_EPOLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_INOTIFY_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_JFSDMAPI_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unshare' function. */ +#undef HAVE_UNSHARE + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* + * vim: syntax=c + */ diff --git a/ltp_framework/include/config.h.in b/ltp_framework/include/config.h.in new file mode 100644 index 0000000..690f43b --- /dev/null +++ b/ltp_framework/include/config.h.in @@ -0,0 +1,292 @@ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_LDT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_PTRACE_H + +/* Define to 1 if you have the `daemon' function. */ +#undef HAVE_DAEMON + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_COARSE', and to + 0 if you don't. */ +#undef HAVE_DECL_CLOCK_MONOTONIC_COARSE + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_RAW', and to 0 + if you don't. */ +#undef HAVE_DECL_CLOCK_MONOTONIC_RAW + +/* Define to 1 if you have the declaration of `CLOCK_REALTIME_COARSE', and to + 0 if you don't. */ +#undef HAVE_DECL_CLOCK_REALTIME_COARSE + +/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if + you don't. */ +#undef HAVE_DECL_MADV_MERGEABLE + +/* Define to 1 if you have the declaration of `MPOL_BIND', and to 0 if you + don't. */ +#undef HAVE_DECL_MPOL_BIND + +/* Define to 1 if you have the declaration of `MPOL_DEFAULT', and to 0 if you + don't. */ +#undef HAVE_DECL_MPOL_DEFAULT + +/* Define to 1 if you have the declaration of `MPOL_F_ADDR', and to 0 if you + don't. */ +#undef HAVE_DECL_MPOL_F_ADDR + +/* Define to 1 if you have the declaration of `MPOL_F_MEMS_ALLOWED', and to 0 + if you don't. */ +#undef HAVE_DECL_MPOL_F_MEMS_ALLOWED + +/* Define to 1 if you have the declaration of `MPOL_F_NODE', and to 0 if you + don't. */ +#undef HAVE_DECL_MPOL_F_NODE + +/* Define to 1 if you have the declaration of `MPOL_INTERLEAVE', and to 0 if + you don't. */ +#undef HAVE_DECL_MPOL_INTERLEAVE + +/* Define to 1 if you have the declaration of `MPOL_PREFERRED', and to 0 if + you don't. */ +#undef HAVE_DECL_MPOL_PREFERRED + +/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if + you don't. */ +#undef HAVE_DECL_PR_CAPBSET_DROP + +/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if + you don't. */ +#undef HAVE_DECL_PR_CAPBSET_READ + +/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if + you don't. */ +#undef HAVE_DECL_PTRACE_GETSIGINFO + +/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and + to 0 if you don't. */ +#undef HAVE_DECL_PTRACE_O_TRACEVFORKDONE + +/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if + you don't. */ +#undef HAVE_DECL_PTRACE_SETOPTIONS + +/* Define to 1 if you have the header file. */ +#undef HAVE_DMAPI_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `io_set_eventfd' function. */ +#undef HAVE_IO_SET_EVENTFD + +/* Define to 1 if you have the libkeyutils development package and keyctl + syscall on your system */ +#undef HAVE_KEYCTL_SYSCALL + +/* Define to 1 if you have libacl installed. */ +#undef HAVE_LIBACL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAIO_H + +/* Define to 1 if you have libcap-2 installed. */ +#undef HAVE_LIBCAP + +/* Define to 1 if you have both SELinux libraries and headers. */ +#undef HAVE_LIBSELINUX_DEVEL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_GENETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MEMPOLICY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MODULE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_NETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_PTRACE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SECUREBITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TASKSTATS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + +/* Define to 1 if you have MADV_MERGEABLE */ +#undef HAVE_MADV_MERGEABLE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MM_H + +/* Define to 1 if you have the `modify_ldt' function. */ +#undef HAVE_MODIFY_LDT + +/* define to 1 if you have all constants required to use mbind tests */ +#undef HAVE_MPOL_CONSTANTS + +/* Define to 1 if you have the header file. */ +#undef HAVE_NUMAIF_H + +/* Define to 1 if you have the `numa_alloc_onnode' function. */ +#undef HAVE_NUMA_ALLOC_ONNODE + +/* Define to 1 if you have the header file. */ +#undef HAVE_NUMA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SHA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have quota v1 */ +#undef HAVE_QUOTAV1 + +/* Define to 1 if you have quota v2 */ +#undef HAVE_QUOTAV2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SELINUX_SELINUX_H + +/* Define to 1 if you have the `signalfd' function. */ +#undef HAVE_SIGNALFD + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ +#undef HAVE_STRUCT_MODIFY_LDT_LDT_S + +/* Define to 1 if the system has the type `struct pt_regs'. */ +#undef HAVE_STRUCT_PT_REGS + +/* Define to 1 if `sa_sigaction' is member of `struct sigaction'. */ +#undef HAVE_STRUCT_SIGACTION_SA_SIGACTION + +/* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */ +#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO + +/* Define to 1 if `ssi_signo' is member of `struct signalfd_siginfo'. */ +#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO + +/* Define to 1 if `freepages_count' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT + +/* Define to 1 if `nvcsw' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_NVCSW + +/* Define to 1 if `read_bytes' is member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_READ_BYTES + +/* Define to 1 if the system has the type `struct user_desc'. */ +#undef HAVE_STRUCT_USER_DESC + +/* Define to 1 if the system has the type `struct user_regs_struct'. */ +#undef HAVE_STRUCT_USER_REGS_STRUCT + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ACL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CAPABILITY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_JFSDMAPI_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PTRACE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_REG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unshare' function. */ +#undef HAVE_UNSHARE + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Target is running Linux w/out an MMU */ +#undef UCLINUX + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER diff --git a/ltp_framework/include/dataascii.h b/ltp_framework/include/dataascii.h new file mode 100644 index 0000000..d08fe86 --- /dev/null +++ b/ltp_framework/include/dataascii.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _DATAASCII_H_ +#define _DATAASCII_H_ + +/*********************************************************************** + * int dataasciigen(listofchars, buffer, size, offset) + * + * This function fills buffer with ascii characters. + * The ascii characters are obtained from listofchars or the CHARS array + * if listofchars is NULL. + * Each char is selected by an index. The index is the remainder + * of count divided by the array size. + * This method allows more than one process to write to a location + * in a file without corrupting it for another process' point of view. + * + * The return value will be the number of character written in buffer + * (size). + * + ***********************************************************************/ +int dataasciigen(char *, char *, int, int); + +/*********************************************************************** + * int dataasciichk(listofchars, buffer, size, count, errmsg) + * + * This function checks the contents of a buffer produced by + * dataasciigen. + * + * return values: + * >= 0 : error at character count + * < 0 : no error + ***********************************************************************/ + +int dataasciichk(char *, char *, int, int, char**); + +#endif diff --git a/ltp_framework/include/databin.h b/ltp_framework/include/databin.h new file mode 100644 index 0000000..93c3863 --- /dev/null +++ b/ltp_framework/include/databin.h @@ -0,0 +1,44 @@ +#ifndef _DATABIN_H_ +#define _DATABIN_H_ + +/******************************************************************************* +* NAME +* databingen - fill a buffer with a data pattern +* +* SYNOPSIS +* (void) databingen(mode, buffer, bsize, offset) +* int mode; +* char *buffer; +* int bsize; +* int offset; +* +* DESCRIPTION +* datagen fills the buffer pointed to by 'buffer' with 'bsize' bytes +* of data of the form indicated by 'mode'. +* All modes (expect r -random) are file offset based. +* This allows more than process to do writing to the file without +* corrupting it if the same modes were used. +* They data modes to choose from, these are: +* +* 'a' - writes an alternating bit pattern (i.e. 0x5555555...) +* +* 'c' - writes a checkerboard pattern (i.e. 0xff00ff00ff00...) +* +* 'C' - writes counting pattern (i.e. 0 - 07, 0 - 07, ...); +* +* 'o' - writes all bits set (i.e. 0xffffffffffffff...) +* +* 'z' - writes all bits cleared (i.e. 0x000000000...); +* +* 'r' - writes random integers +* +* RETURN VALUE +* None +* +*******************************************************************************/ + +void databingen( int mode, char *buffer, int bsize, int offset ); + +int databinchk( int mode, char *buffer, int bsize, int offset, char **errmsg); + +#endif diff --git a/ltp_framework/include/file_lock.h b/ltp_framework/include/file_lock.h new file mode 100644 index 0000000..7586260 --- /dev/null +++ b/ltp_framework/include/file_lock.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _FILE_LOCK_H_ +#define _FILE_LOCK_H_ + +extern char Fl_syscall_str[128]; + +int file_lock( int , int, char ** ); +int record_lock( int , int , int , int , char ** ); + +#if defined(__sun) || defined(__hpux) +#define LOCK_NB 0x0001 +#define LOCK_UN 0x0002 +#define LOCK_EX 0x0004 +#define LOCK_SH 0x0008 +#endif +#endif /* _FILE_LOCK_H_ */ diff --git a/ltp_framework/include/forker.h b/ltp_framework/include/forker.h new file mode 100644 index 0000000..dfad625 --- /dev/null +++ b/ltp_framework/include/forker.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _FORKER_H_ +#define _FORKER_H_ + +#define FORKER_MAX_PIDS 4098 + +extern int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ +extern int Forker_npids; /* number of entries in Forker_pids */ + +/* + * This function will fork and the parent will exit zero and + * the child will return. This will orphan the returning process + * putting it in the background. + */ +int background( char * ); + +/* + * Forker will fork ncopies-1 copies of self. + * + * arg 1: Number of copies of the process to be running after return. + * This value minus one is the number of forks performed. + * arg 2: mode: 0 - all children are first generation descendents. + * 1 - each subsequent child is a descendent of another + * descendent, resulting in only one direct descendent of the + * parent and each other child is a child of another child in + * relation to the parent. + * arg 3: prefix: string to preceed any error messages. A value of NULL + * results in no error messages on failure. + * returns: returns to parent the number of children forked. + */ +int forker( int , int , char * ); + +#endif /* _FORKER_H_ */ diff --git a/ltp_framework/include/libtestsuite.h b/ltp_framework/include/libtestsuite.h new file mode 100644 index 0000000..0668961 --- /dev/null +++ b/ltp_framework/include/libtestsuite.h @@ -0,0 +1,20 @@ +/* The following functions are used to synchronize father and sons processes. + * + * create_sync_pipes: create pipes used for the synchronization. Must be done + * by father process before a fork. + * + * wait_son_startup: wait a son process to reach the "notify_startup" function. + * + * notify_startup: notify the father process a son has started its execution. + */ +#include +#include +#include + +/* fifo_name is used to create named pipe. NULL means anonymous pipe. */ +#define PIPE_NAME NULL +int sync_pipe_create( int fd[], const char *pipe_name); +int sync_pipe_close(int fd[], const char *pipe_name); +int sync_pipe_wait( int fd[]); +int sync_pipe_notify( int fd[]); + diff --git a/ltp_framework/include/ltp_signal.h b/ltp_framework/include/ltp_signal.h new file mode 100644 index 0000000..1ac6f70 --- /dev/null +++ b/ltp_framework/include/ltp_signal.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. + * Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Author: Liu Bo + * Author: Garrett Cooper + * + */ + +#ifndef __LTP_SIGNAL_H +#define __LTP_SIGNAL_H + +#include +#include +#include +#include "config.h" + +#define SIGSETSIZE (_NSIG / 8) + +#ifdef LTP_RT_SIG_TEST + +#ifdef __x86_64__ + +/* + * From asm/signal.h -- this value isn't exported anywhere outside of glibc and + * asm/signal.h and is only required for the rt_sig* function family because + * sigaction(2), et all, appends this if necessary to + * (struct sigaction).sa_flags. HEH. + * + * I do #undef though, just in case... + * + * Also, from .../arch/x86/kernel/signal.c:448 for v2.6.30 (something or + * other): + * + * x86-64 should always use SA_RESTORER. + * + * -- thus SA_RESTORER must always be defined along with + * (struct sigaction).sa_restorer for this architecture. + */ +#undef SA_RESTORER +#define HAVE_SA_RESTORER +#define SA_RESTORER 0x04000000 + +struct kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned long sa_flags; + void (*sa_restorer) (void); + sigset_t sa_mask; +}; + +void (*restore_rt) (void); + +inline void +handler_h (int signal) +{ + return; +} + +/* Setup an initial signal handler for signal number = sig for x86_64. */ +inline int +sig_initial(int sig) +{ + int ret_code = -1; + struct sigaction act, oact; + + act.sa_handler = handler_h; + /* Clear out the signal set. */ + if (sigemptyset(&act.sa_mask) < 0) { + /* Add the signal to the mask set. */ + } else if (sigaddset(&act.sa_mask, sig) < 0) { + /* Set act.sa_restorer via syscall(2) */ + } else if (sigaction(sig, &act, &oact) < 0) { + /* Copy oact.sa_restorer via syscall(2) */ + } else if (sigaction(sig, &act, &oact) < 0) { + /* And voila -- we just tricked the kernel into giving us our + * restorer function! */ + } else { + restore_rt = oact.sa_restorer; + ret_code = 0; + } + + return ret_code; + +} + +#endif /* __x86_64__ */ + +#endif /* LTP_RT_SIG_TEST */ + +#endif diff --git a/ltp_framework/include/mk/automake.mk b/ltp_framework/include/mk/automake.mk new file mode 100644 index 0000000..e5a4fe0 --- /dev/null +++ b/ltp_framework/include/mk/automake.mk @@ -0,0 +1,117 @@ +# +# Autotools include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# Override these variables to use non-system available tools. +ACLOCAL ?= aclocal +AUTOCONF ?= autoconf +AUTOHEADER ?= autoheader +AUTOMAKE ?= automake + +AUTOCONFED_SUBDIRS = \ + testcases/realtime + +# We want to run this every single time to ensure that all of the prereq files +# are there. +.PHONY: testcases/realtime/configure +testcases/realtime/configure: + $(MAKE) -C $(@D) autotools + +.PHONY: autotools +autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS)) + +.PHONY: aclocal +aclocal: aclocal.m4 + +aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4 + $(ACLOCAL) -I m4 + +.PHONY: autoconf +autoconf: configure + +configure: configure.ac aclocal.m4 + $(AUTOCONF) + +.PHONY: autoheader +autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4 + $(AUTOHEADER) + +include: + mkdir -p "$@" + +m4/ltp-version.m4: ChangeLog + sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@ + +.PHONY: automake +AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1 +automake: aclocal $(AUTOMAKE_FILES) +$(AUTOMAKE_FILES): m4/Makefile.in +m4/Makefile.in: m4/Makefile.am aclocal.m4 + $(AUTOMAKE) -c -a + +.PHONY: ac-clean ac-distclean ac-maintainer-clean +ac-clean:: + $(RM) -rf autom4te.cache + $(RM) -f config.log config.status + $(RM) -f include/config.h include/stamp-h1 + $(RM) -f m4/Makefile m4/ltp-version.m4 + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + +ac-distclean:: ac-clean +ac-maintainer-clean:: ac-distclean + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + $(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in + $(RM) -f include/*config.h.in + +# Don't include config.h, or make will (rightfully) whine about overriding +# rules. +# +# This list should match the files in configure.ac. +# +AUTOGENERATED_FILES = \ + include/mk/config.mk \ + include/mk/features.mk \ + lib/ltp.pc \ + m4/Makefile \ + ltp-devel.spec \ + execltp \ + README.ltp-devel + +distclean:: %: clean ac-distclean + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + $(RM) -f $(AUTOGENERATED_FILES) + +maintainer-clean:: distclean ac-maintainer-clean + +$(AUTOGENERATED_FILES): $(top_builddir)/config.status + $(SHELL) $^ + +# This variable is automatically changed from help to all once someone has +# run configure, or the equivalent steps manually, as described in INSTALL. +$(abs_top_builddir)/include/mk/config.mk \ +$(abs_top_builddir)/include/mk/features.mk: + $(MAKE) -C $(top_srcdir) help; false diff --git a/ltp_framework/include/mk/config.mk b/ltp_framework/include/mk/config.mk new file mode 100644 index 0000000..de7a353 --- /dev/null +++ b/ltp_framework/include/mk/config.mk @@ -0,0 +1,82 @@ +# +# config.mk.in. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# See this page for more info about LEX*: +# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html + +# Application specifying variables. You should never have to change these. +AR := arm-linux-gnueabi-ar +CC := arm-linux-gnueabi-gcc +LEX := : +RANLIB := arm-linux-gnueabi-ranlib +STRIP := arm-linux-gnueabi-strip +YACC := yacc + +# XXX: I'm lazy... but if someone has a working javac, they should have a +# working jar on their systems. +JAR := jar +JAVAC := @JAVAC@ + +AIO_LIBS := +CAP_LIBS := +ACL_LIBS := +CRYPTO_LIBS := +LEXLIB := +NUMA_CPPFLAGS := +NUMA_LIBS := +SELINUX_LIBS := + +prefix := /opt/ltp + +datarootdir := ${prefix}/share +includedir := ${prefix}/include +exec_prefix := ${prefix} +bindir := ${exec_prefix}/bin +libdir := ${exec_prefix}/lib +mandir := ${datarootdir}/man + +RPMBUILD ?= rpmbuild + +CPPFLAGS := +CFLAGS := -g -O2 +LDLIBS := +LDFLAGS := + +DEBUG_CFLAGS ?= -g +DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS) + +# Please see README.mk-devel about -fstrict-aliasing. +OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe +OPT_CXXFLAGS ?= $(OPT_CFLAGS) + +WCFLAGS ?= -Wall +WCXXFLAGS ?= $(WCFLAGS) + +LDFLAGS += $(WLDFLAGS) +CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) +CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS) + +ifeq ($(strip $(prefix)),) +$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) +endif + +export datarootdir includedir libdir mandir prefix diff --git a/ltp_framework/include/mk/config.mk.default b/ltp_framework/include/mk/config.mk.default new file mode 100644 index 0000000..8248071 --- /dev/null +++ b/ltp_framework/include/mk/config.mk.default @@ -0,0 +1,76 @@ +# +# config.mk.in. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# See this page for more info about LEX*: +# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html + +# Application specifying variables. You should never have to change these. +AR := ar +CC := gcc +LEX := flex +RANLIB := ranlib +STRIP := strip +YACC := bison -y + +#JAR := jar +#JAVAC := javac + +#AIO_LIBS := -laio +#CAP_LIBS := -lcap +#ACL_LIBS := -lacl +#CRYPTO_LIBS := -lcrypto +#LEXLIB := -lfl +#NUMA_CPPFLAGS := -DNUMA_VERSION1_COMPATIBILITY +#NUMA_LIBS := -lnuma +#SELINUX_LIBS := -lselinux + +prefix := /opt/ltp + +datarootdir := ${prefix}/share +includedir := ${prefix}/include +exec_prefix := ${prefix} +bindir := ${exec_prefix}/bin +libdir := ${exec_prefix}/lib +mandir := ${datarootdir}/man + +RPMBUILD ?= rpmbuild + +CPPFLAGS := +CFLAGS := -g -O2 +LDLIBS := +LDFLAGS := + +DEBUG_CFLAGS ?= -g +DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS) + +# Please see README.mk-devel about -fstrict-aliasing. +OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe +OPT_CXXFLAGS ?= $(OPT_CFLAGS) + +WCFLAGS ?= -Wall +WCXXFLAGS ?= $(WCFLAGS) + +LDFLAGS += $(WLDFLAGS) +CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) +CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS) + +export datarootdir includedir libdir mandir prefix diff --git a/ltp_framework/include/mk/config.mk.in b/ltp_framework/include/mk/config.mk.in new file mode 100644 index 0000000..b835c86 --- /dev/null +++ b/ltp_framework/include/mk/config.mk.in @@ -0,0 +1,82 @@ +# +# config.mk.in. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# See this page for more info about LEX*: +# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html + +# Application specifying variables. You should never have to change these. +AR := @AR@ +CC := @CC@ +LEX := @LEX@ +RANLIB := @RANLIB@ +STRIP := @STRIP@ +YACC := @YACC@ + +# XXX: I'm lazy... but if someone has a working javac, they should have a +# working jar on their systems. +JAR := jar +JAVAC := @JAVAC@ + +AIO_LIBS := @AIO_LIBS@ +CAP_LIBS := @CAP_LIBS@ +ACL_LIBS := @ACL_LIBS@ +CRYPTO_LIBS := @CRYPTO_LIBS@ +LEXLIB := @LEXLIB@ +NUMA_CPPFLAGS := @NUMA_CPPFLAGS@ +NUMA_LIBS := @NUMA_LIBS@ +SELINUX_LIBS := @SELINUX_LIBS@ + +prefix := @prefix@ + +datarootdir := @datarootdir@ +includedir := @includedir@ +exec_prefix := @exec_prefix@ +bindir := @bindir@ +libdir := @libdir@ +mandir := @mandir@ + +RPMBUILD ?= rpmbuild + +CPPFLAGS := @CPPFLAGS@ +CFLAGS := @CFLAGS@ +LDLIBS := @LIBS@ +LDFLAGS := @LDFLAGS@ + +DEBUG_CFLAGS ?= -g +DEBUG_CXXFLAGS ?= $(DEBUG_CFLAGS) + +# Please see README.mk-devel about -fstrict-aliasing. +OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe +OPT_CXXFLAGS ?= $(OPT_CFLAGS) + +WCFLAGS ?= -Wall +WCXXFLAGS ?= $(WCFLAGS) + +LDFLAGS += $(WLDFLAGS) +CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) +CXXFLAGS += $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS) + +ifeq ($(strip $(prefix)),) +$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) +endif + +export datarootdir includedir libdir mandir prefix diff --git a/ltp_framework/include/mk/env_post.mk b/ltp_framework/include/mk/env_post.mk new file mode 100644 index 0000000..ebaee1f --- /dev/null +++ b/ltp_framework/include/mk/env_post.mk @@ -0,0 +1,104 @@ +# +# Environment post-setup Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +ENV_PRE_LOADED ?= $(error You must load env_pre.mk before including this file) + +include $(top_srcdir)/include/mk/functions.mk + +ifndef ENV_POST_LOADED +ENV_PRE_LOADED = 1 + +# Default source search path. Modify as necessary, but I would call that +# poor software design if you need more than one search directory, and +# would suggest creating a general purpose static library to that end. +vpath %.c $(abs_srcdir) + +# For config.h, et all. +CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include + +LDFLAGS += -L$(top_builddir)/lib + +ifeq ($(UCLINUX),1) +CPPFLAGS += -D__UCLIBC__ -DUCLINUX +endif + +MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c))) + +MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS)) + +CLEAN_TARGETS += $(MAKE_TARGETS) *.o *.pyc + +# Majority of the files end up in testcases/bin... +INSTALL_DIR ?= testcases/bin + +ifneq ($(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)) + +ifeq ($(strip $(INSTALL_DIR)),) +INSTALL_DIR := $(error You must define INSTALL_DIR before including this file) +endif + +ifneq ($(strip $(prefix)),) +# Value specified by INSTALL_DIR isn't an absolute path, so let's tack on $(prefix). +ifneq ($(patsubst /%,,$(INSTALL_DIR)),) +INSTALL_DIR := $(prefix)/$(INSTALL_DIR) +endif + +# Glob any possible expressions, but make sure to zap the $(abs_srcdir) +# reference at the start of the filename instead of using $(notdir), so that +# way we don't accidentally nuke the relative path from $(abs_srcdir) that +# may have been set in the Makefile. +INSTALL_TARGETS := $(wildcard $(addprefix $(abs_srcdir)/,$(INSTALL_TARGETS))) +INSTALL_TARGETS := $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS)) + +# The large majority of the files that we install are going to be apps and +# scripts, so let's chmod them like that. +INSTALL_MODE ?= 00775 + +ifdef MAKE_3_80_COMPAT + +INSTALL_PATH := $(call MAKE_3_80_abspath,$(DESTDIR)/$(INSTALL_DIR)) + +INSTALL_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(INSTALL_TARGETS))) +MAKE_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(MAKE_TARGETS))) + +INSTALL_FILES := $(INSTALL_TARGETS_ABS) $(MAKE_TARGETS_ABS) + +$(INSTALL_TARGETS_ABS): + test -d "$(@D)" || mkdir -p "$(@D)" + install -m $(INSTALL_MODE) "$(abs_srcdir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" + +$(MAKE_TARGETS_ABS): + test -d "$(@D)" || mkdir -p "$(@D)" + install -m $(INSTALL_MODE) "$(abs_builddir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" +else +$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))): + mkdir -p "$@" +$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR)))) +$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR)))) +endif + +else # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) +$(error You must define $$(prefix) before executing install) +endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) +endif + +endif diff --git a/ltp_framework/include/mk/env_pre.mk b/ltp_framework/include/mk/env_pre.mk new file mode 100644 index 0000000..f1584a8 --- /dev/null +++ b/ltp_framework/include/mk/env_pre.mk @@ -0,0 +1,144 @@ +# +# Make pre-include environment Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, September 2009 +# +# This Makefile must be included first. NO IF'S, AND'S, OR BUT'S. +# +# This sets the stage for all operations required within Makefiles. +# + +ifndef ENV_PRE_LOADED +ENV_PRE_LOADED = 1 + +# "out-of-build-tree" build. +BUILD_TREE_BUILDDIR_INSTALL := 1 +# "in-srcdir" build / install. +BUILD_TREE_SRCDIR_INSTALL := 2 +# "in-srcdir" build, non-srcdir install. +BUILD_TREE_NONSRCDIR_INSTALL := 3 +# configure not run. +BUILD_TREE_UNCONFIGURED := 4 + +ifndef MAKE_VERSION_CHECK +export MAKE_VERSION_CHECK = 1 +ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80) +$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80; 3.81+ is preferred) +else +ifneq ($(filter 3.80%,$(MAKE_VERSION)),) +export MAKE_3_80_COMPAT := 1 +endif # make 3.80? +endif # At least make 3.80? +endif # MAKE_VERSION_CHECK + +# Get the absolute path for the source directory. +top_srcdir ?= $(error You must define top_srcdir before including this file) + +include $(top_srcdir)/include/mk/functions.mk + +# Where's the root source directory? +ifdef MAKE_3_80_COMPAT +abs_top_srcdir := $(call MAKE_3_80_abspath,$(top_srcdir)) +else +abs_top_srcdir := $(abspath $(top_srcdir)) +endif + +# +# Where's the root object directory? +# +# Just in case it's not specified, set it to the top srcdir (because the user +# must not have wanted out of build tree support)... +# +top_builddir ?= $(top_srcdir) + +# We need the absolute path... +ifdef MAKE_3_80_COMPAT +abs_top_builddir := $(call MAKE_3_80_abspath,$(top_builddir)) +else +abs_top_builddir := $(abspath $(top_builddir)) +endif + +# Where's the root object directory? +builddir := . + +abs_builddir := $(CURDIR) + +cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir)) + +# Where's the source located at? Squish all of the / away by using abspath... +ifdef MAKE_3_80_COMPAT +abs_srcdir := $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top)) +else +abs_srcdir := $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top)) +endif + +srcdir := $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir))) + +ifeq ($(srcdir),) +srcdir := . +endif + +# autotools, *clean, and help don't require config.mk, features.mk, etc... +ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),) + +include $(abs_top_builddir)/include/mk/config.mk +include $(abs_top_builddir)/include/mk/features.mk + +# START out-of-build-tree check. +ifneq ($(abs_builddir),$(abs_srcdir)) +BUILD_TREE_STATE := $(BUILD_TREE_BUILDDIR_INSTALL) +else +# Else, not out of build tree.. + +# START srcdir build-tree install checks +ifeq ($(strip $(DESTDIR)$(prefix)),) +BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) +else # Empty $(DESTDIR)$(prefix) +ifeq ($(abs_top_srcdir),$(prefix)) +BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) +endif +# END srcdir build-tree install checks +endif +# END out-of-build-tree check. +endif + +# Is the build-tree configured yet? +ifeq ($(BUILD_TREE_STATE),) +ifneq ($(wildcard $(abs_top_builddir)/include/mk/config.mk),) +BUILD_TREE_STATE := $(BUILD_TREE_NONSRCDIR_INSTALL) +endif +endif + +ifeq ($(MAKE_3_80_COMPAT),1) +# Trick make 3.80 into thinking that the default goal is all. +.PHONY: default +default: all +else +.DEFAULT_GOAL := all +endif + +endif # END autotools, *clean... + +BUILD_TREE_STATE ?= $(BUILD_TREE_UNCONFIGURED) + +# We can piece together where we're located in the source and object trees with +# just these two vars and $(CURDIR). +export abs_top_srcdir abs_top_builddir BUILD_TREE_STATE + +endif diff --git a/ltp_framework/include/mk/features.mk b/ltp_framework/include/mk/features.mk new file mode 100644 index 0000000..d06a80a --- /dev/null +++ b/ltp_framework/include/mk/features.mk @@ -0,0 +1,55 @@ +# +# features.mk.in - feature tuning include Makefile. +# +# Copyright (C) 2010, Linux Test Project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, October 2010 +# + +# Path to capset program +CAPSET := + +# Tools enable knobs +WITH_EXPECT := no + +WITH_PERL := no + +WITH_PYTHON := no + +# Features knobs + +# Is securebits[.h], et all support available? +HAVE_SECUREBITS := yes + +# Test suite knobs + +# Enable testcases/kernel/power_management's compile and install? +ifeq ($(UCLINUX),1) +WITH_POWER_MANAGEMENT_TESTSUITE := no +else +WITH_POWER_MANAGEMENT_TESTSUITE := no +endif + +# Enable testcases/open_posix_testsuite's compile and install? +WITH_OPEN_POSIX_TESTSUITE := no + +# Enable testcases/realtime's compile and install? +ifeq ($(UCLINUX),1) +WITH_REALTIME_TESTSUITE := no +else +WITH_REALTIME_TESTSUITE := no +endif diff --git a/ltp_framework/include/mk/features.mk.default b/ltp_framework/include/mk/features.mk.default new file mode 100644 index 0000000..53ea30c --- /dev/null +++ b/ltp_framework/include/mk/features.mk.default @@ -0,0 +1,55 @@ +# +# features.mk.default - feature tuning include Makefile. +# +# Copyright (C) 2010, Linux Test Project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, October 2010 +# + +# Path to capset program +CAPSET := + +# Tools enable knobs +WITH_EXPECT := no + +WITH_PERL := no + +WITH_PYTHON := no + +# Features knobs + +# Is securebits[.h], et all support available? +HAVE_SECUREBITS := no + +# Test suite knobs + +# Enable testcases/kernel/power_management's compile and install? +ifeq ($(UCLINUX),1) +WITH_POWER_MANAGEMENT_TESTSUITE := no +else +WITH_POWER_MANAGEMENT_TESTSUITE := +endif + +# Enable testcases/open_posix_testsuite's compile and install? +WITH_OPEN_POSIX_TESTSUITE := no + +# Enable testcases/realtime's compile and install? +ifeq ($(UCLINUX),1) +WITH_REALTIME_TESTSUITE := no +else +WITH_REALTIME_TESTSUITE := no +endif diff --git a/ltp_framework/include/mk/features.mk.in b/ltp_framework/include/mk/features.mk.in new file mode 100644 index 0000000..3472159 --- /dev/null +++ b/ltp_framework/include/mk/features.mk.in @@ -0,0 +1,55 @@ +# +# features.mk.in - feature tuning include Makefile. +# +# Copyright (C) 2010, Linux Test Project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, October 2010 +# + +# Path to capset program +CAPSET := @CAPSET@ + +# Tools enable knobs +WITH_EXPECT := @WITH_EXPECT@ + +WITH_PERL := @WITH_PERL@ + +WITH_PYTHON := @WITH_PYTHON@ + +# Features knobs + +# Is securebits[.h], et all support available? +HAVE_SECUREBITS := @HAVE_SECUREBITS@ + +# Test suite knobs + +# Enable testcases/kernel/power_management's compile and install? +ifeq ($(UCLINUX),1) +WITH_POWER_MANAGEMENT_TESTSUITE := no +else +WITH_POWER_MANAGEMENT_TESTSUITE := @WITH_POWER_MANAGEMENT_TESTSUITE@ +endif + +# Enable testcases/open_posix_testsuite's compile and install? +WITH_OPEN_POSIX_TESTSUITE := @WITH_OPEN_POSIX_TESTSUITE@ + +# Enable testcases/realtime's compile and install? +ifeq ($(UCLINUX),1) +WITH_REALTIME_TESTSUITE := no +else +WITH_REALTIME_TESTSUITE := @WITH_REALTIME_TESTSUITE@ +endif diff --git a/ltp_framework/include/mk/functions.mk b/ltp_framework/include/mk/functions.mk new file mode 100644 index 0000000..fc58737 --- /dev/null +++ b/ltp_framework/include/mk/functions.mk @@ -0,0 +1,76 @@ +# +# A Makefile with a collection of reusable functions. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +SQUOTE := ' + +# ' # to keep colorized editors from going nuts + +MAKE_3_80_realpath = $(shell $(top_srcdir)/scripts/realpath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') + +MAKE_3_80_abspath = $(shell $(top_srcdir)/scripts/abspath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') + +# +# NOTE (garrcoop): +# +# The following functions are (sometimes) split into 3.80 and 3.81+ +# counterparts, and not conditionalized inside of the define(s) to work around +# an issue with how make 3.80 evaluates defines. +# +# SO DO NOT INTERNALIZE CONDITIONALS IN DEFINES OR YOU WILL BREAK MAKE 3.80! +# + +# +# Generate an install rule which also creates the install directory if needed +# to avoid unnecessary bourne shell based for-loops and install errors, as well +# as adhoc install rules. +# +# 1 -> Target basename. +# 2 -> Source directory. +# 3 -> Destination directory. +# +ifdef MAKE_3_80_COMPAT +define generate_install_rule + +INSTALL_FILES += $$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)) + +$$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)): \ + $$(call MAKE_3_80_abspath,$$(dir $$(DESTDIR)/$(3)/$(1))) + install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" +endef +else # not MAKE_3_80_COMPAT +define generate_install_rule + +INSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1)) + +$$(abspath $$(DESTDIR)/$(3)/$(1)): \ + $$(abspath $$(dir $$(DESTDIR)/$(3)/$(1))) + install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" +endef +endif # END MAKE_3_80_COMPAT + +# +# Set SUBDIRS to the subdirectories where Makefiles were found. +# +define get_make_dirs +SUBDIRS ?= $$(subst $$(abs_srcdir)/,,$$(patsubst %/Makefile,%,$$(wildcard $$(abs_srcdir)/*/Makefile))) +SUBDIRS := $$(filter-out $$(FILTER_OUT_DIRS),$$(SUBDIRS)) +endef diff --git a/ltp_framework/include/mk/generic_leaf_target.inc b/ltp_framework/include/mk/generic_leaf_target.inc new file mode 100644 index 0000000..a88586f --- /dev/null +++ b/ltp_framework/include/mk/generic_leaf_target.inc @@ -0,0 +1,106 @@ +# +# Generic leaf rules include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# +# generic_leaf_target +# +# Generate a set of basic targets (all, clean, install) for a leaf directory +# (no subdirectories). +# +# $(MAKE_DEPS) : What should we execute beforehand as a +# dependency of $(MAKE_TARGETS)? +# +# $(INSTALL_FILES) -> install +# +# Helpful variables are: +# +# $(MAKE_TARGETS) : What to execute as direct dependencies of +# all. +# 1. Defaults to the basename of the targets +# produced by the %.c -> % implicit pattern +# rules, e.g. the MAKE_TARGET in a directory +# like the following: +# +# $$ ls /bar +# foo.c +# +# Would be `foo'. Similarly, the following +# dir structure: +# +# $$ ls /bar +# foo.c zanzibar.c +# +# Would be `foo zanzibar'. +# +# 2. If you define MAKE_TARGETS as an empty +# string, this will override the defaults. +# I did this to avoid providing too much +# rope to hang one's self in the event of +# unwanted behavior. +# +# $(CLEAN_TARGETS) : What targets should be cleaned (must be +# real files). This will automatically append +# adds the .o suffix to all files referenced +# by $(MAKE_TARGETS)) to CLEAN_TARGETS, if +# MAKE_TARGETS wasn't defined (see +# $(MAKE_TARGETS)). +# $(INSTALL_MODE) : What mode should we using when calling +# install(1)? +# +# Also, if you wish to change the installation directory, from the set default +# (testcases/bin) you must do something like either one of the following items: +# +# Method A: +# +# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)/$(prefix) +# +# e.g. if I wanted to install my binaries in testcases/bin, I would do: +# +# INSTALL_DIR := testcases/bin +# +# in my calling Makefile. +# +# Or Method B: +# +# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR) +# +# e.g. if I wanted to install my binaries in $(libdir) (which may not exist +# outside of $(prefix) right now, but could in the future), I could do the +# following: +# +# INSTALL_DIR := $(libdir) +# + +.PHONY: all clean install + +$(MAKE_TARGETS): | $(MAKE_DEPS) + +all: $(MAKE_TARGETS) + +clean:: $(CLEAN_DEPS) + -$(RM) -f $(CLEAN_TARGETS) + +$(INSTALL_FILES): | $(INSTALL_DEPS) + +install: $(INSTALL_FILES) + +# vim: syntax=make diff --git a/ltp_framework/include/mk/generic_leaf_target.mk b/ltp_framework/include/mk/generic_leaf_target.mk new file mode 100644 index 0000000..cb6db5e --- /dev/null +++ b/ltp_framework/include/mk/generic_leaf_target.mk @@ -0,0 +1,24 @@ +# +# Generic leaf include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_post.mk +include $(top_srcdir)/include/mk/generic_leaf_target.inc diff --git a/ltp_framework/include/mk/generic_trunk_target.inc b/ltp_framework/include/mk/generic_trunk_target.inc new file mode 100644 index 0000000..86d654c --- /dev/null +++ b/ltp_framework/include/mk/generic_trunk_target.inc @@ -0,0 +1,97 @@ +# +# Generic trunk rules include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# +# generic_trunk_target +# +# Generate a set of recursive targets to apply over a trunk directory (has +# directories) -- optionally with a set of trunk-based files. +# +# All variables in this canned define are essentially the same as +# generic_leaf_target, with the exception that the install flow for local +# targets is: +# +# $(INSTALL_FILES) -> trunk-install -> install (recursive) +# +# All recursive targets are traverse SUBDIRS as defined by the user, or if +# undefined, defaults to any subdirectories where Makefile's are contained +# within. +# +# generic_trunk_target specific variables are: +# +# RECURSIVE_TARGETS : a list of targets to apply over an entire +# directory tree. This defaults to +# `all install'. +# +# See generic_leaf_target, generic_target_env_setup, and get_make_dirs for +# more details and design notes. +# + +include $(top_srcdir)/include/mk/functions.mk + +RECURSIVE_TARGETS ?= all install + +$(eval $(get_make_dirs)) + +.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS)) + +$(SUBDIRS): %: + mkdir -m 00755 -p "$@" + +$(MAKE_TARGETS): | $(MAKE_DEPS) + +trunk-all: $(MAKE_TARGETS) + +trunk-clean:: | $(SUBDIRS) + $(if $(strip $(CLEAN_TARGETS)),$(RM) -f $(CLEAN_TARGETS)) + +$(INSTALL_FILES): | $(INSTALL_DEPS) + +trunk-install: $(INSTALL_FILES) + +# Avoid creating duplicate .PHONY references to all, clean, and install. IIRC, +# I've seen some indeterministic behavior when one does this in the past with +# GNU Make... +.PHONY: $(filter-out $(RECURSIVE_TARGETS),all clean install) +all: trunk-all + +clean:: trunk-clean + @set -e; for dir in $(SUBDIRS); do \ + $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +ifneq ($(abs_builddir),$(abs_srcdir)) + $(RM) -Rf $(SUBDIRS) +endif + +install: trunk-install + +# Print out CURDIR to check for a recursion issue. +ifeq ($(strip $(SUBDIRS)),) + $(warning CURDIR is: $(CURDIR)) +else +$(RECURSIVE_TARGETS): %: | $(SUBDIRS) + @set -e; for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +endif + +# vim: syntax=make diff --git a/ltp_framework/include/mk/generic_trunk_target.mk b/ltp_framework/include/mk/generic_trunk_target.mk new file mode 100644 index 0000000..f480ef6 --- /dev/null +++ b/ltp_framework/include/mk/generic_trunk_target.mk @@ -0,0 +1,24 @@ +# +# Generic trunk include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_post.mk +include $(top_srcdir)/include/mk/generic_trunk_target.inc diff --git a/ltp_framework/include/mk/gitignore.mk b/ltp_framework/include/mk/gitignore.mk new file mode 100644 index 0000000..b9932fb --- /dev/null +++ b/ltp_framework/include/mk/gitignore.mk @@ -0,0 +1,51 @@ +# +# gitignore generation include Makefile. +# +# Copyright (C) 2011, Linux Test Project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, January 2011 +# + +CLEAN_TARGETS+= gitignore_clean + +BEFORE:= .gitignore-before + +AFTER:= .gitignore-after + +IGNORE_DIR_EXPR:= egrep -v "^$$(echo "$(AUTOCONFED_SUBDIRS)" | tr " " "|")" + +# NOTE: The underscore is used in place of a dash to avoid implicit rule +# evaluation in top-level Makefile. +.PHONY: gitignore_clean +gitignore_clean: + $(RM) -f $(BEFORE) $(AFTER) + +$(BEFORE): + $(MAKE) distclean + $(MAKE) ac-maintainer-clean + find . | $(IGNORE_DIR_EXPR) > $@ + +$(AFTER): + $(MAKE) autotools + ./configure --prefix=/dev/null + $(MAKE) all + find . | $(IGNORE_DIR_EXPR) > $@ + # Set everything in autoconf land back to a sane state. + $(MAKE) distclean + +.gitignore: | $(BEFORE) $(AFTER) + diff -u $(BEFORE) $(AFTER) | grep '^+' | sed -e 's,^\+,,g' > $@ diff --git a/ltp_framework/include/mk/lib.mk b/ltp_framework/include/mk/lib.mk new file mode 100644 index 0000000..bc0c45d --- /dev/null +++ b/ltp_framework/include/mk/lib.mk @@ -0,0 +1,64 @@ +# +# library include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +# Makefile to include for libraries. + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(libdir) + +# An extension of generic_leaf_target, strictly for libraries. +.PHONY: install_headers + +ifndef LIB +$(error You must define LIB when including this Makefile) +endif + +install_headers: $(addprefix $(DESTDIR)/$(includedir)/,$(notdir $(HEADER_FILES))) + +INSTALL_MODE ?= 00664 + +MAKE_TARGETS := $(LIB) + +LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c) + +ifdef MAKE_3_80_COMPAT +LIBSRCS := $(call MAKE_3_80_abspath,$(LIBSRCS)) +else +LIBSRCS := $(abspath $(LIBSRCS)) +endif + +LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS))) + +LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS)) + +LIBOBJS := $(LIBSRCS:.c=.o) + +$(LIB): $(notdir $(LIBOBJS)) + if [ -z "$(strip $^)" ] ; then \ + echo "Cowardly refusing to create empty archive"; \ + exit 1; \ + fi + $(if $(AR),$(AR),ar) -rc "$@" $^ + $(if $(RANLIB),$(RANLIB),ranlib) "$@" + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/ltp_framework/include/mk/man.mk b/ltp_framework/include/mk/man.mk new file mode 100644 index 0000000..f0b4525 --- /dev/null +++ b/ltp_framework/include/mk/man.mk @@ -0,0 +1,37 @@ +# +# Manpage include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +ifeq ($(strip $(MANPREFIX)),) +$(error $$(MANPREFIX) not defined) +endif + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(mandir)/man$(MANPREFIX) + +INSTALL_MODE := 00644 + +INSTALL_TARGETS ?= *.$(MANPREFIX) + +MAKE_TARGETS := + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/ltp_framework/include/mk/testcases.mk b/ltp_framework/include/mk/testcases.mk new file mode 100644 index 0000000..ea26d4f --- /dev/null +++ b/ltp_framework/include/mk/testcases.mk @@ -0,0 +1,55 @@ +# +# testcases include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Garrett Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_pre.mk +include $(top_srcdir)/include/mk/functions.mk + +APICMDS_DIR := $(abs_top_builddir)/tools/apicmds + +TKI_DIR := testcases/kernel/include + +LSN_H := $(abs_top_builddir)/$(TKI_DIR)/linux_syscall_numbers.h + +LIBLTP_DIR := $(abs_top_builddir)/lib + +LIBLTP := $(LIBLTP_DIR)/libltp.a + +$(APICMDS_DIR)/tst_kvercmp: $(APICMDS_DIR) + $(MAKE) -C "$^" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all + +$(LIBLTP): $(LIBLTP_DIR) + $(MAKE) -C "$^" -f "$(abs_top_srcdir)/lib/Makefile" all + +$(LSN_H): $(abs_top_builddir)/$(TKI_DIR) + $(MAKE) -C "$^" -f "$(abs_top_srcdir)/$(TKI_DIR)/Makefile" all + +MAKE_DEPS := $(LIBLTP) $(LSN_H) + +# For linux_syscall_numbers.h +CPPFLAGS += -I$(abs_top_builddir)/$(TKI_DIR) + +INSTALL_DIR := testcases/bin + +LDLIBS += -lltp + +$(APICMDS_DIR) $(LIBLTP_DIR) $(abs_top_builddir)/$(TKI_DIR): %: + mkdir -p "$@" diff --git a/ltp_framework/include/open_flags.h b/ltp_framework/include/open_flags.h new file mode 100644 index 0000000..966d684 --- /dev/null +++ b/ltp_framework/include/open_flags.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _OPEN_FLAGS_H_ +#define _OPEN_FLAGS_H_ + +/*********************************************************************** + * This function attempts to convert open flag bits into human readable + * symbols (i.e. O_TRUNC). If there are more than one symbol, + * the string will be placed as a separator between symbols. + * Commonly used separators would be a comma "," or pipe "|". + * If is one and not all bits can be converted to + * symbols, the "UNKNOWN" symbol will be added to return string. + * + * Return Value + * openflags2symbols will return the indentified symbols. + * If no symbols are recognized the return value will be a empty + * string or the "UNKNOWN" symbol. + * + * Limitations + * Currently (05/96) all known symbols are coded into openflags2symbols. + * If new open flags are added this code will have to updated + * to know about them or they will not be recognized. + * + * The Open_symbols must be large enough to hold all possible symbols + * for a given system. + * + ***********************************************************************/ +char *openflags2symbols( int, char *, int ); + +/*********************************************************************** + * This function will take a string of comma separated open flags symbols + * and translate them into an open flag bitmask. + * If any symbol is not valid, -1 is returned. On this error condition + * the badname pointer is updated if not NULL. badname will point + * to the beginning location of where the invalid symbol was found. + * string will be returned unchanged. + * + * A signal received while parsing string could cause the string to + * contain a NULL character in the middle of it. + * + ***********************************************************************/ +int parse_open_flags( char *, char ** ); + +#endif diff --git a/ltp_framework/include/pattern.h b/ltp_framework/include/pattern.h new file mode 100644 index 0000000..29c75d3 --- /dev/null +++ b/ltp_framework/include/pattern.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _PATTERN_H_ +#define _PATTERN_H_ + +/* + * pattern_check(buf, buflen, pat, patlen, patshift) + * + * Check a buffer of length buflen against repeated occurrances of + * a pattern whose length is patlen. Patshift can be used to rotate + * the pattern by patshift bytes to the left. + * + * Patshift may be greater than patlen, the pattern will be rotated by + * (patshift % patshift) bytes. + * + * pattern_check returns -1 if the buffer does not contain repeated + * occurrances of the indicated pattern (shifted by patshift). + * + * The algorithm used to check the buffer relies on the fact that buf is + * supposed to be repeated copies of pattern. The basic algorithm is + * to validate the first patlen bytes of buf against the pat argument + * passed in - then validate the next patlen bytes against the 1st patlen + * bytes - the next (2*patlen) bytes against the 1st (2*pathen) bytes, and + * so on. This algorithm only works when the assumption of a buffer full + * of repeated copies of a pattern holds, and gives MUCH better results + * then walking the buffer byte by byte. + * + * Performance wise, It appears to be about 5% slower than doing a straight + * memcmp of 2 buffers, but the big win is that it does not require a + * 2nd comparison buffer, only the pattern. + */ +int pattern_check( char * , int , char * , int , int ); + +/* + * pattern_fill(buf, buflen, pat, patlen, patshift) + * + * Fill a buffer of length buflen with repeated occurrances of + * a pattern whose length is patlen. Patshift can be used to rotate + * the pattern by patshift bytes to the left. + * + * Patshift may be greater than patlen, the pattern will be rotated by + * (patshift % patlen) bytes. + * + * If buflen is not a multiple of patlen, a partial pattern will be written + * in the last part of the buffer. This implies that a buffer which is + * shorter than the pattern length will receive only a partial pattern ... + * + * pattern_fill always returns 0 - no validation of arguments is done. + * + * The algorithm used to fill the buffer relies on the fact that buf is + * supposed to be repeated copies of pattern. The basic algorithm is + * to fill the first patlen bytes of buf with the pat argument + * passed in - then copy the next patlen bytes with the 1st patlen + * bytes - the next (2*patlen) bytes with the 1st (2*pathen) bytes, and + * so on. This algorithm only works when the assumption of a buffer full + * of repeated copies of a pattern holds, and gives MUCH better results + * then filling the buffer 1 byte at a time. + */ +int pattern_fill( char * , int , char * , int , int ); + +#endif diff --git a/ltp_framework/include/random_range.h b/ltp_framework/include/random_range.h new file mode 100644 index 0000000..c8c4858 --- /dev/null +++ b/ltp_framework/include/random_range.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _RANDOM_RANGE_H_ +#define _RANDOM_RANGE_H_ + +int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); +int range_min ( char *, int ); +int range_max ( char *, int ); +int range_mult ( char *, int ); +long random_range ( int, int, int, char ** ); +long random_rangel ( long, long, long, char ** ); +long long random_rangell ( long long, long long, long long, char ** ); +void random_range_seed( long ); +long random_bit ( long ); + +#endif diff --git a/ltp_framework/include/rmobj.h b/ltp_framework/include/rmobj.h new file mode 100644 index 0000000..4808ca2 --- /dev/null +++ b/ltp_framework/include/rmobj.h @@ -0,0 +1,12 @@ +#ifndef _RMOBJ_H_ +#define _RMOBJ_H_ + +/* + * rmobj() - Remove the specified object. If the specified object is a + * directory, recursively remove everything inside of it. If + * there are any problems, set errmsg (if it is not NULL) and + * return -1. Otherwise return 0. + */ +int rmobj( char *object , char **errmesg ); + +#endif diff --git a/ltp_framework/include/safe_macros.h b/ltp_framework/include/safe_macros.h new file mode 100644 index 0000000..3753b7f --- /dev/null +++ b/ltp_framework/include/safe_macros.h @@ -0,0 +1,139 @@ +/* + * Safe macros for commonly used syscalls to reduce code duplication in LTP + * testcases, and to ensure all errors are caught in said testcases as + * gracefully as possible. + * + * Also satiates some versions of gcc/glibc when the warn_unused_result + * attribute is applied to the function call. + * + * Licensed under the GPLv2. + */ + +#ifndef __TEST_H__ +#error "you must include test.h before this file" +#else + +#ifndef __SAFE_MACROS_H__ +#define __SAFE_MACROS_H__ + +#include +#include +#include +#include +#include +#include + +char* safe_basename(const char *file, const int lineno, + void (*cleanup_fn)(void), char *path); +#define SAFE_BASENAME(cleanup_fn, path) \ + safe_basename(__FILE__, __LINE__, (cleanup_fn), (path)) + +int safe_chdir(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *path); +#define SAFE_CHDIR(cleanup_fn, path) \ + safe_chdir(__FILE__, __LINE__, (cleanup_fn), (path)) + +int safe_close(const char *file, const int lineno, + void (*cleanup_fn)(void), int fildes); +#define SAFE_CLOSE(cleanup_fn, fildes) \ + safe_close(__FILE__, __LINE__, (cleanup_fn), (fildes)) + +int safe_creat(const char *file, const int lineno, + void (*cleanup_fn)(void), char *pathname, mode_t mode); +#define SAFE_CREAT(cleanup_fn, pathname, mode) \ + safe_creat(__FILE__, __LINE__, cleanup_fn, (pathname), (mode)) + +char* safe_dirname(const char *file, const int lineno, + void (*cleanup_fn)(void), char *path); +#define SAFE_DIRNAME(cleanup_fn, path) \ + safe_dirname(__FILE__, __LINE__, (cleanup_fn), (path)) + +char* safe_getcwd(const char *file, const int lineno, + void (*cleanup_fn)(void), char *buf, size_t size); +#define SAFE_GETCWD(cleanup_fn, buf, size) \ + safe_getcwd(__FILE__, __LINE__, (cleanup_fn), (buf), (size)) + +struct passwd* safe_getpwnam(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *name); +#define SAFE_GETPWNAM(cleanup_fn, name) \ + safe_getpwnam(__FILE__, __LINE__, cleanup_fn, (name)) + +int safe_getrusage(const char *file, const int lineno, + void (*cleanup_fn)(void), int who, struct rusage *usage); +#define SAFE_GETRUSAGE(cleanup_fn, who, usage) \ + safe_getrusage(__FILE__, __LINE__, (cleanup_fn), (who), (usage)) + +void* safe_malloc(const char *file, const int lineno, + void (*cleanup_fn)(void), size_t size); +#define SAFE_MALLOC(cleanup_fn, size) \ + safe_malloc(__FILE__, __LINE__, (cleanup_fn), (size)) + +int safe_mkdir(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, mode_t mode); +#define SAFE_MKDIR(cleanup_fn, pathname, mode) \ + safe_mkdir(__FILE__, __LINE__, (cleanup_fn), (pathname), (mode)) + +void* safe_mmap(const char *file, const int lineno, + void (*cleanup_fn)(void), void *addr, size_t length, int prot, + int flags, int fd, off_t offset); +#define SAFE_MMAP(cleanup_fn, addr, length, prot, flags, fd, offset) \ + safe_mmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length), (prot), \ + (flags), (fd), (offset)) + +int safe_munmap(const char *file, const int lineno, + void (*cleanup_fn)(void), void *addr, size_t length); +#define SAFE_MUNMAP(cleanup_fn, addr, length) \ + safe_munmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length)) + +int safe_open(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, int oflags, ...); +#define SAFE_OPEN(cleanup_fn, pathname, oflags, ...) \ + safe_open(__FILE__, __LINE__, (cleanup_fn), (pathname), (oflags), \ + ##__VA_ARGS__) + +int safe_pipe(const char *file, const int lineno, + void (*cleanup_fn)(void), int fildes[2]); +#define SAFE_PIPE(cleanup_fn, fildes) \ + safe_pipe(__FILE__, __LINE__, cleanup_fn, (fildes)) + +ssize_t safe_read(const char *file, const int lineno, + void (*cleanup_fn)(void), char len_strict, int fildes, void *buf, + size_t nbyte); +#define SAFE_READ(cleanup_fn, len_strict, fildes, buf, nbyte) \ + safe_read(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ + (buf), (nbyte)) + +int safe_setegid(const char *file, const int lineno, + void (*cleanup_fn)(void), gid_t egid); +#define SAFE_SETEGID(cleanup_fn, egid) \ + safe_setegid(__FILE__, __LINE__, cleanup_fn, (egid)) + +int safe_seteuid(const char *file, const int lineno, + void (*cleanup_fn)(void), uid_t euid); +#define SAFE_SETEUID(cleanup_fn, euid) \ + safe_seteuid(__FILE__, __LINE__, cleanup_fn, (euid)) + +int safe_setgid(const char *file, const int lineno, + void (*cleanup_fn)(void), gid_t gid); +#define SAFE_SETGID(cleanup_fn, gid) \ + safe_setgid(__FILE__, __LINE__, cleanup_fn, (gid)) + +int safe_setuid(const char *file, const int lineno, + void (*cleanup_fn)(void), uid_t uid); +#define SAFE_SETUID(cleanup_fn, uid) \ + safe_setuid(__FILE__, __LINE__, cleanup_fn, (uid)) + +int safe_unlink(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname); +#define SAFE_UNLINK(cleanup_fn, pathname) \ + safe_unlink(__FILE__, __LINE__, cleanup_fn, (pathname)) + +ssize_t safe_write(const char *file, const int lineno, + void (cleanup_fn)(void), char len_strict, int fildes, + const void *buf, size_t nbyte); +#define SAFE_WRITE(cleanup_fn, len_strict, fildes, buf, nbyte) \ + safe_write(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ + (buf), (nbyte)) + +#endif +#endif diff --git a/ltp_framework/include/search_path.h b/ltp_framework/include/search_path.h new file mode 100644 index 0000000..c81d42c --- /dev/null +++ b/ltp_framework/include/search_path.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +/* $Id: search_path.h,v 1.2 2009/07/20 10:59:32 vapier Exp $ */ + + +int search_path(char *cmd, char *res_path, int access_mode, int fullpath); diff --git a/ltp_framework/include/stamp-h1 b/ltp_framework/include/stamp-h1 new file mode 100644 index 0000000..b330768 --- /dev/null +++ b/ltp_framework/include/stamp-h1 @@ -0,0 +1 @@ +timestamp for include/config.h diff --git a/ltp_framework/include/str_to_bytes.h b/ltp_framework/include/str_to_bytes.h new file mode 100644 index 0000000..977a6b1 --- /dev/null +++ b/ltp_framework/include/str_to_bytes.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _STR_TO_BYTES_ +#define _STR_TO_BYTES_ + +int str_to_bytes ( char * ); +long str_to_lbytes ( char * ); +long long str_to_llbytes( char * ); + +#endif diff --git a/ltp_framework/include/string_to_tokens.h b/ltp_framework/include/string_to_tokens.h new file mode 100644 index 0000000..75c7d24 --- /dev/null +++ b/ltp_framework/include/string_to_tokens.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _STRING_TO_TOKENS_H_ +#define _STRING_TO_TOKENS_H_ + +/* + * string_to_tokens() + * + * This function parses the string 'arg_string', placing pointers to + * the 'separator' separated tokens into the elements of 'arg_array'. + * The array is terminated with a null pointer. + * + * NOTE: This function uses strtok() to parse 'arg_string', and thus + * physically alters 'arg_string' by placing null characters where the + * separators originally were. + */ +int string_to_tokens(char *, char **, int, char *); + +#endif diff --git a/ltp_framework/include/swaponoff.h b/ltp_framework/include/swaponoff.h new file mode 100644 index 0000000..e3eae3f --- /dev/null +++ b/ltp_framework/include/swaponoff.h @@ -0,0 +1,18 @@ + +#ifndef __SWAP_ON_OFF_H_ +#define __SWAP_ON_OFF_H_ + +/* + * Read swapon(2) / swapoff(2) for a full history lesson behind the value of + * MAX_SWAPFILES. + */ +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) +#define MAX_SWAPFILES 30 +#elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 10) +#define MAX_SWAPFILES 32 +#else +#define MAX_SWAPFILES 8 +#endif + +#endif diff --git a/ltp_framework/include/system_specific_hugepages_info.h b/ltp_framework/include/system_specific_hugepages_info.h new file mode 100644 index 0000000..f5e3c46 --- /dev/null +++ b/ltp_framework/include/system_specific_hugepages_info.h @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) International Business Machines Corp., 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _SYS_SPECIFIC_HUGEPAGES_INFO_H_ +#define _SYS_SPECIFIC_HUGEPAGES_INFO_H_ + +/*Returns Total No. of available Hugepages in the system from /proc/meminfo*/ +int get_no_of_hugepages(void); +/*Returns No. of Hugepages_Free from /proc/meminfo*/ +int get_no_of_free_hugepages(void); +/*Returns Hugepages Size from /proc/meminfo*/ +int hugepages_size(void); + +#endif diff --git a/ltp_framework/include/system_specific_process_info.h b/ltp_framework/include/system_specific_process_info.h new file mode 100644 index 0000000..956d90f --- /dev/null +++ b/ltp_framework/include/system_specific_process_info.h @@ -0,0 +1,29 @@ +/* + * + * Copyright (c) International Business Machines Corp., 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _SYS_SPECIFIC_PROCESS_INFO_H_ +#define _SYS_SPECIFIC_PROCESS_INFO_H_ + +/* Returns max pid count obtained from reading /proc/sys/kernel/pid_max */ +int get_max_pids(void); + +/* Returns number of free pids */ +int get_free_pids(void); + +#endif diff --git a/ltp_framework/include/test.h b/ltp_framework/include/test.h new file mode 100644 index 0000000..033fdbc --- /dev/null +++ b/ltp_framework/include/test.h @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2009 Cyril Hrubis chrubis@suse.cz + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +/* $Id: test.h,v 1.26 2010/01/10 22:27:15 yaberauneya Exp $ */ + +#ifndef __TEST_H__ +#define __TEST_H__ + +#include +#include +#include +#include +#include + +#include "compiler.h" + +/* Use low 6 bits to encode test type */ +#define TTYPE_MASK 0x3f +#define TPASS 0 /* Test passed flag */ +#define TFAIL 1 /* Test failed flag */ +#define TBROK 2 /* Test broken flag */ +#define TWARN 4 /* Test warning flag */ +#define TRETR 8 /* Test retire flag */ +#define TINFO 16 /* Test information flag */ +#define TCONF 32 /* Test not appropriate for configuration flag */ +#define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK) + +#define TERRNO 0x100 /* Append errno information to output */ +#define TTERRNO 0x200 /* Append TEST_ERRNO information to output */ +#define TRERRNO 0x300 /* Capture errno information from TEST_RETURN to + output; useful for pthread-like APIs :). */ + +/* + * To determine if you are on a Umk or Unicos system, + * use sysconf(_SC_CRAY_SYSTEM). But since _SC_CRAY_SYSTEM + * is not defined until 90, it will be define here if not already + * defined. + * if (sysconf(_SC_CRAY_SYSTEM) == 1) + * on UMK + * else # returned 0 or -1 + * on Unicos + * This is only being done on CRAY systems. + */ +#ifdef CRAY +#ifndef _SC_CRAY_SYSTEM +#define _SC_CRAY_SYSTEM 140 +#endif /* ! _SC_CRAY_SYSTEM */ +#endif /* CRAY */ + +/* + * Ensure that NUMSIGS is defined. + * It should be defined in signal.h or sys/signal.h on + * UNICOS/mk and IRIX systems. On UNICOS systems, + * it is not defined, thus it is being set to UNICOS's NSIG. + * Note: IRIX's NSIG (signals are 1-(NSIG-1)) + * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) + */ +#ifndef NUMSIGS +#define NUMSIGS NSIG +#endif + + +/* defines for unexpected signal setup routine (set_usig.c) */ +#define FORK 1 /* SIGCLD is to be ignored */ +#define NOFORK 0 /* SIGCLD is to be caught */ +#define DEF_HANDLER SIG_ERR /* tells set_usig() to use default signal handler */ + +/* + * The following defines are used to control tst_res and t_result reporting. + */ + +#define TOUTPUT "TOUTPUT" /* The name of the environment variable */ + /* that can be set to one of the following */ + /* strings to control tst_res output */ + /* If not set, TOUT_VERBOSE_S is assumed */ + +#define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ +#define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ +#define TOUT_DISCARD_S "DISCARD" /* No output is reported */ + +/* + * The following defines are used to control tst_tmpdir, tst_wildcard and t_mkchdir + */ + +#define TDIRECTORY "TDIRECTORY" /* The name of the environment variable */ + /* that if is set, the value (directory) */ + /* is used by all tests as their working */ + /* directory. tst_rmdir and t_rmdir will */ + /* not attempt to clean up. */ + /* This environment variable should only */ + /* be set when doing system testing since */ + /* tests will collide and break and fail */ + /* because of setting it. */ + +#define TEMPDIR "/tmp" /* This is the default temporary directory. */ + /* The environment variable TMPDIR is */ + /* used prior to this valid by tempnam(3). */ + /* To control the base location of the */ + /* temporary directory, set the TMPDIR */ + /* environment variable to desired path */ + +/* + * The following define contains the name of an environmental variable + * that can be used to specify the number of iterations. + * It is supported in parse_opts.c and USC_setup.c. + */ +#define USC_ITERATION_ENV "USC_ITERATIONS" + +/* + * The following define contains the name of an environmental variable + * that can be used to specify to iteration until desired time + * in floating point seconds has gone by. + * Supported in USC_setup.c. + */ +#define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" + +/* + * The following define contains the name of an environmental variable + * that can be used to specify that no functional checks are wanted. + * It is supported in parse_opts.c and USC_setup.c. + */ +#define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" + +/* + * The following define contains the name of an environmental variable + * that can be used to specify the delay between each loop iteration. + * The value is in seconds (fractional numbers are allowed). + * It is supported in parse_opts.c. + */ +#define USC_LOOP_DELAY "USC_LOOP_DELAY" + +/* + * fork() can't be used on uClinux systems, so use FORK_OR_VFORK instead, + * which will run vfork() on uClinux. + * mmap() doesn't support MAP_PRIVATE on uClinux systems, so use + * MAP_PRIVATE_EXCEPT_UCLINUX instead, which will skip the option on uClinux. + * If MAP_PRIVATE really is required, the test can not be run on uClinux. + */ +#ifdef UCLINUX +#define FORK_OR_VFORK vfork +#define MAP_PRIVATE_EXCEPT_UCLINUX 0 +#else +#define FORK_OR_VFORK fork +#define MAP_PRIVATE_EXCEPT_UCLINUX MAP_PRIVATE +#endif + +/* + * lib/forker.c + */ +extern int Forker_pids[]; +extern int Forker_npids; + +/* lib/tst_res.c */ +const char *strttype(int ttype); +void tst_res(int ttype, char *fname, char *arg_fmt, ...) + __attribute__ ((format (printf, 3, 4))); +void tst_resm(int ttype, char *arg_fmt, ...) + __attribute__ ((format (printf, 2, 3))); +void tst_brk(int ttype, char *fname, void (*func)(void), char *arg_fmt, ...) + __attribute__ ((format (printf, 4, 5))); +void tst_brkm(int ttype, void (*func)(void), char *arg_fmt, ...) + __attribute__ ((format (printf, 3, 4))) LTP_ATTRIBUTE_NORETURN; +void tst_require_root(void (*func)(void)); +int tst_environ(void); +void tst_exit(void) LTP_ATTRIBUTE_NORETURN; +void tst_flush(void); + +extern int Tst_count; + +/* lib/tst_sig.c */ +void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); + +/* lib/tst_tmpdir.c */ +void tst_tmpdir(void); +void tst_rmdir(void); +char *get_tst_tmpdir(void); + +/* lib/get_high_address.c */ +char *get_high_address(void); + +/* lib/tst_kvercmp.c */ +void tst_getkver(int *k1, int *k2, int *k3); +int tst_kvercmp(int r1, int r2, int r3); + +/* lib/tst_is_cwd.c */ +int tst_is_cwd_nfs(void); +int tst_is_cwd_v9fs(void); +int tst_is_cwd_tmpfs(void); +int tst_is_cwd_ramfs(void); + +/* lib/tst_cwd_has_free.c */ +int tst_cwd_has_free(int required_kib); + +/* lib/self_exec.c */ +void maybe_run_child(void (*child)(), char *fmt, ...); +int self_exec(char *argv0, char *fmt, ...); + +/* Functions from lib/cloner.c */ +int ltp_clone(unsigned long clone_flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack); +int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg), + void *arg, size_t stacksize); +int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), + void *arg); +#define clone(...) use_the_ltp_clone_functions,do_not_use_clone + +/* Functions from lib/mount_utils.c */ +char *get_block_device(const char *path); +char *get_mountpoint(const char *path); + +/* Function from lib/get_path.c */ +int tst_get_path(const char *prog_name, char *buf, size_t buf_len); + +#ifdef TST_USE_COMPAT16_SYSCALL +#define TCID_BIT_SUFFIX "_16" +#elif TST_USE_NEWER64_SYSCALL +#define TCID_BIT_SUFFIX "_64" +#else +#define TCID_BIT_SUFFIX "" +#endif +#define TCID_DEFINE(ID) char *TCID = (#ID TCID_BIT_SUFFIX) + +#endif /* __TEST_H__ */ diff --git a/ltp_framework/include/tlibio.h b/ltp_framework/include/tlibio.h new file mode 100644 index 0000000..0ac52e4 --- /dev/null +++ b/ltp_framework/include/tlibio.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +#define LIO_IO_SYNC 00001 /* read/write */ +#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ +#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ +#define LIO_IO_ALISTIO 00010 /* single stride async listio */ +#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ +#define LIO_IO_SYNCP 00040 /* pread/pwrite */ + +#ifdef sgi +#define LIO_IO_ATYPES 00077 /* all io types */ +#define LIO_IO_TYPES 00061 /* all io types, non-async */ +#endif /* sgi */ +#if defined(__linux__) && !defined(__UCLIBC__) +#define LIO_IO_TYPES 00061 /* all io types */ +#define LIO_IO_ATYPES 00077 /* all io types */ +#endif +#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__) +#define LIO_IO_TYPES 00021 /* all io types except pread/pwrite */ +#endif /* linux */ +#ifdef CRAY +#define LIO_IO_TYPES 00017 /* all io types */ +#endif /* CRAY */ + +#ifndef LIO_IO_ATYPES +#define LIO_IO_ATYPES LIO_IO_TYPES +#endif + +#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ +#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ +#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ +#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ +#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ +#if defined(sgi) || defined(__linux__) +#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ +#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ +#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ +#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ +#endif /* sgi */ +#if defined(__sun) || defined(__hpux) || defined(_AIX) +#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ +#endif /* linux */ +#ifdef CRAY +#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ +#endif /* CRAY */ + +/* meta wait io */ +/* 00 000 0000 */ + +#if defined(sgi) || defined(__linux__) +/* all callback wait types */ +#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) +/* all aio_{read,write} or lio_listio */ +#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) +#endif /* sgi */ +#if defined(__sun) || defined(__hpux) || defined(_AIX) +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) +#endif /* linux */ +#ifdef CRAY +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) +#endif /* CRAY */ + +/* + * This bit provides a way to randomly pick an io type and wait method. + * lio_read_buffer() and lio_write_buffer() functions will call + * lio_random_methods() with the given method. + */ +#define LIO_RANDOM 010000000 + +/* + * This bit provides a way for the programmer to use async i/o with + * signals and to use their own signal handler. By default, + * the signal will only be given to the system call if the wait + * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. + * Whenever these wait methods are used, libio signal handler + * will be used. + */ +#define LIO_USE_SIGNAL 020000000 + +/* + * prototypes/structures for functions in the libio.c module. See comments + * in that module, or man page entries for information on the individual + * functions. + */ + +int stride_bounds(int offset, int stride, int nstrides, + int bytes_per_stride, int *min_byte, int *max_byte); + +int lio_set_debug(int level); +int lio_parse_io_arg1(char *string); +void lio_help1(char *prefex); +int lio_parse_io_arg2(char *string, char **badtoken); +void lio_help2(char *prefex); +int lio_write_buffer(int fd, int method, char *buffer, int size, + int sig, char **errmsg, long wrd); + +int lio_read_buffer(int fd, int method, char *buffer, int size, + int sig, char **errmsg, long wrd); +int lio_random_methods(long mask); + +#if CRAY +#include +int lio_wait4asyncio(int method, int fd, struct iosw **statptr); +int lio_check_asyncio(char *io_type, int size, struct iosw *status); +#endif /* CRAY */ +#if defined (sgi) +#include +int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); +int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); +#endif /* sgi */ +#if defined(__linux__) && !defined(__UCLIBC__) +#include +int lio_wait4asyncio(int method, int fd, struct aiocb *aiocbp); +int lio_check_asyncio(char *io_type, int size, struct aiocb *aiocbp, int method); +#endif + +/* + * Define the structure that contains the infomation that is used + * by the parsing and help functions. + */ +struct lio_info_type { + char *token; + int bits; + char *desc; +}; + + diff --git a/ltp_framework/include/usctest.h b/ltp_framework/include/usctest.h new file mode 100644 index 0000000..04f0e9c --- /dev/null +++ b/ltp_framework/include/usctest.h @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +/* $Id: usctest.h,v 1.14 2009/08/28 10:03:01 vapier Exp $ */ + +/********************************************************** + * + * IRIX/Linux Feature Test and Evaluation - Silicon Graphics, Inc. + * + * FUNCTION NAME : usctest.h + * + * FUNCTION TITLE : System Call Test Macros + * + * SYNOPSIS: + * See DESCRIPTION below. + * + * AUTHOR : William Roske + * + * INITIAL RELEASE : UNICOS 7.0 + * + * DESCRIPTION + * TEST(SCALL) - calls a system call + * TEST_VOID(SCALL) - same as TEST() but for syscalls with no return value. + * TEST_CLEANUP - print the log of errno return counts if STD_ERRNO_LOG + * is set. + * TEST_PAUSEF(HAND) - Pause for SIGUSR1 if the pause flag is set. + * Use "hand" as the interrupt handling function + * TEST_PAUSE - Pause for SIGUSR1 if the pause flag is set. + * Use internal function to do nothing on signal and go on. + * TEST_LOOPING(COUNTER) - Conditional to check if test should + * loop. Evaluates to TRUE (1) or FALSE (0). + * TEST_ERROR_LOG(eno) - log that this errno was received, + * if STD_ERRNO_LOG is set. + * TEST_EXP_ENOS(array) - set the bits in TEST_VALID_ENO array at + * positions specified in integer "array" + * + * RETURN VALUE + * TEST(SCALL) - Global Variables set: + * long TEST_RETURN=return code from SCALL + * int TEST_ERRNO=value of errno at return from SCALL + * TEST_VOID(SCALL) - Global Variables set: + * int TEST_ERRNO=value of errno at return from SCALL + * TEST_CLEANUP - None. + * TEST_PAUSEF(HAND) - None. + * TEST_PAUSE - None. + * TEST_LOOPING(COUNTER) - True if COUNTER < STD_LOOP_COUNT or + * STD_INFINITE is set. + * TEST_ERROR_LOG(eno) - None + * TEST_EXP_ENOS(array) - None + * + * KNOWN BUGS + * If you use the TEST_PAUSE or TEST_LOOPING macros, you must + * link in parse_opts.o, which contains the code for those functions. + * + *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/ + +#ifndef __USCTEST_H__ +#define __USCTEST_H__ 1 + +#ifndef _SC_CLK_TCK +#include +#endif + +#include + +/* + * Ensure that PATH_MAX is defined + */ +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +#ifndef CRAY +#ifndef BSIZE +#define BSIZE BBSIZE +#endif +#endif + +/*********************************************************************** + * Define option_t structure type. + * Entries in this struct are used by the parse_opts routine + * to indicate valid options and return option arguments + ***********************************************************************/ +typedef struct { + char *option; /* Valid option string (one option only) like "a:" */ + int *flag; /* pointer to location to set true if option given */ + char **arg; /* pointer to location to place argument, if needed */ +} option_t; + +/*********************************************************************** + * The following globals are defined in parse_opts.c but must be + * externed here because they are used in the macros defined below. + ***********************************************************************/ +extern int STD_FUNCTIONAL_TEST, /* turned off by -f to not do functional test */ + STD_TIMING_ON, /* turned on by -t to print timing stats */ + STD_PAUSE, /* turned on by -p to pause before loop */ + STD_INFINITE, /* turned on by -i0 to loop forever */ + STD_LOOP_COUNT, /* changed by -in to set loop count to n */ + STD_ERRNO_LOG, /* turned on by -e to log errnos returned */ + STD_ERRNO_LIST[], /* counts of errnos returned. indexed by errno */ + STD_COPIES, + STD_argind; + +extern float STD_LOOP_DURATION, /* wall clock time to iterate */ + STD_LOOP_DELAY; /* delay time after each iteration */ + +#define USC_MAX_ERRNO 2000 + +/********************************************************************** + * Prototype for parse_opts routine + **********************************************************************/ +extern char *parse_opts(int ac, char **av, const option_t *user_optarr, void (*uhf)()); + + +/* + * define a structure + */ +struct usc_errno_t { + int flag; +}; + +/*********************************************************************** + **** + **** + **** + **********************************************************************/ +#ifdef _USC_LIB_ + +extern long TEST_RETURN; +extern int TEST_ERRNO; +extern struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; + +#else +/*********************************************************************** + * Global array of bit masks to indicate errnos that are expected. + * Bits set by TEST_EXP_ENOS() macro and used by TEST_CLEANUP() macro. + ***********************************************************************/ +struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO]; + +/*********************************************************************** + * Globals for returning the return code and errno from the system call + * test macros. + ***********************************************************************/ +long TEST_RETURN; +int TEST_ERRNO; + +#endif /* _USC_LIB_ */ + +/*********************************************************************** + * structure for timing accumulator and counters + ***********************************************************************/ +struct tblock { + long tb_max; + long tb_min; + long tb_total; + long tb_count; +}; + +/*********************************************************************** + * The following globals are externed here so that they are accessable + * in the macros that follow. + ***********************************************************************/ +extern struct tblock tblock; +extern void STD_go(); +extern int (*_TMP_FUNC)(void); +extern void STD_opts_help(); + + +/*********************************************************************** + * TEST: calls a system call + * + * parameters: + * SCALL = system call and parameters to execute + * + ***********************************************************************/ +#define TEST(SCALL) \ + do { \ + errno = 0; \ + TEST_RETURN = SCALL; \ + TEST_ERRNO = errno; \ + } while (0) + +/*********************************************************************** + * TEST_VOID: calls a system call + * + * parameters: + * SCALL = system call and parameters to execute + * + * Note: This is IDENTICAL to the TEST() macro except that it is intended + * for use with syscalls returning no values (void syscall()). The + * Typecasting nothing (void) into an unsigned integer causes compilation + * errors. + * + ***********************************************************************/ +#define TEST_VOID(SCALL) do { errno = 0; SCALL; TEST_ERRNO = errno; } while (0) + +/*********************************************************************** + * TEST_CLEANUP: print system call timing stats and errno log entries + * to stdout if STD_TIMING_ON and STD_ERRNO_LOG are set, respectively. + * Do NOT print ANY information if no system calls logged. + * + * parameters: + * none + * + ***********************************************************************/ +#define TEST_CLEANUP \ +do { \ + int i; \ + if (!STD_ERRNO_LOG) \ + break; \ + for (i = 0; i < USC_MAX_ERRNO; ++i) { \ + if (!STD_ERRNO_LIST[i]) \ + continue; \ + tst_resm(TINFO, "ERRNO %d:\tReceived %d Times%s", \ + i, STD_ERRNO_LIST[i], \ + TEST_VALID_ENO[i].flag ? "" : " ** UNEXPECTED **"); \ + } \ +} while (0) + +/*********************************************************************** + * TEST_PAUSEF: Pause for SIGUSR1 if the pause flag is set. + * Set the user specified function as the interrupt + * handler instead of "STD_go" + * + * parameters: + * none + * + ***********************************************************************/ +#define TEST_PAUSEF(HANDLER) \ +do { \ + if (STD_PAUSE) { \ + _TMP_FUNC = (int (*)())signal(SIGUSR1, HANDLER); \ + pause(); \ + signal(SIGUSR1, (void (*)())_TMP_FUNC); \ + } \ +} while (0) + +/*********************************************************************** + * TEST_PAUSE: Pause for SIGUSR1 if the pause flag is set. + * Just continue when signal comes in. + * + * parameters: + * none + * + ***********************************************************************/ +#define TEST_PAUSE usc_global_setup_hook(); +int usc_global_setup_hook(); + +/*********************************************************************** + * TEST_LOOPING now call the usc_test_looping function. + * The function will return 1 if the test should continue + * iterating. + * + ***********************************************************************/ +#define TEST_LOOPING usc_test_looping +int usc_test_looping(int counter); + +/*********************************************************************** + * TEST_ERROR_LOG(eno): log this errno if STD_ERRNO_LOG flag set + * + * parameters: + * int eno: the errno location in STD_ERRNO_LIST to log. + * + ***********************************************************************/ +#define TEST_ERROR_LOG(eno) \ +do { \ + int _eno = (eno); \ + if ((STD_ERRNO_LOG) && (_eno < USC_MAX_ERRNO)) \ + STD_ERRNO_LIST[_eno]++; \ +} while (0) + +/*********************************************************************** + * TEST_EXP_ENOS(array): set the bits associated with the nput errnos + * in the TEST_VALID_ENO array. + * + * parameters: + * int array[]: a zero terminated array of errnos expected. + * + ***********************************************************************/ +#define TEST_EXP_ENOS(array) \ +do { \ + int i = 0; \ + while (array[i] != 0) { \ + if (array[i] < USC_MAX_ERRNO) \ + TEST_VALID_ENO[array[i]].flag = 1; \ + ++i; \ + } \ +} while (0) + +#endif /* end of __USCTEST_H__ */ diff --git a/ltp_framework/include/write_log.h b/ltp_framework/include/write_log.h new file mode 100644 index 0000000..84d6313 --- /dev/null +++ b/ltp_framework/include/write_log.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _WRITE_LOG_H_ +#define _WRITE_LOG_H_ + +/* + * Constants defining the max size of various wlog_rec fields. ANY SIZE + * CHANGES HERE MUST BE REFLECTED IN THE WLOG_REC_DISK STRUCTURE DEFINED + * BELOW. + */ + +#define WLOG_MAX_PATH 128 +#define WLOG_MAX_PATTERN 64 +#define WLOG_MAX_HOST 8 +#define WLOG_REC_MAX_SIZE (sizeof(struct wlog_rec)+WLOG_MAX_PATH+WLOG_MAX_PATTERN+WLOG_MAX_HOST+2) + +/* + * User view of a write log record. Note that this is not necessiliary + * how the data is formatted on disk (signifigant compression occurrs), so + * don't expect to od the write log file and see things formatted this way. + */ + +struct wlog_rec { + int w_pid; /* pid doing the write */ + int w_offset; /* file offset */ + int w_nbytes; /* # bytes written */ + int w_oflags; /* low-order open() flags */ + int w_done; /* 1 if io confirmed done */ + int w_async; /* 1 if async write (writea) */ + + char w_host[WLOG_MAX_HOST+1]; /* host doing write - */ + /* null terminated */ + int w_hostlen; /* host name length */ + char w_path[WLOG_MAX_PATH+1]; /* file written to - */ + /* null terminated */ + int w_pathlen; /* file name length */ + char w_pattern[WLOG_MAX_PATTERN+1]; /* pattern written - */ + /* null terminated */ + int w_patternlen; /* pattern length */ +}; + +#ifndef uint +#define uint unsigned int +#endif + +/* + * On-disk structure of a wlog_rec. Actually, the record consists of + * 3 parts: [wlog_rec_disk structure][variable length data][length] + * where length is a 2 byte field containing the total record length + * (including the 2 bytes). It is used for scanning the logfile in reverse + * order. + * + * The variable length data includes the path, host, and pattern (in that + * order). The lengths of these pieces of data are held in the + * wlog_rec_disk structure. Thus, the actual on-disk record looks like + * this (top is lower byte offset): + * + * struct wlog_rec_disk + * path (w_pathlen bytes - not null terminated) + * host (w_hostlen bytes - not null terminated) + * pattern (w_patternlen bytes - not null terminated) + * 2-byte record length + * + * Another way of looking at it is: + * + * --> + * --> + * + * The maximum length of this record is defined by the WLOG_REC_MAX_SIZE + * record. Note that the 2-byte record length forces this to be + * <= 64k bytes. + * + * Note that there is lots of bit-masking done here. The w_pathlen, + * w_hostlen, and w_patternlen fields MUST have enough bits to hold + * WLOG_MAX_PATH, WLOG_MAX_HOST, and WLOG_MAX_PATTERN bytes respectivly. + */ + +struct wlog_rec_disk { +#ifdef CRAY + uint w_offset : 44; /* file offset */ + uint w_extra0 : 20; /* EXTRA BITS IN WORD 0 */ +#else + /* NB: sgi is pissy about fields > 32 bit, even cc -mips3 */ + uint w_offset : 32; /* file offset */ + uint w_extra0 : 32; /* EXTRA BITS IN WORD 0 */ +#endif + + uint w_nbytes : 32; /* # bytes written */ + uint w_oflags : 32; /* low-order open() flags */ + + uint w_pid : 17; /* pid doing the write */ + uint w_pathlen : 7; /* length of file path */ + uint w_patternlen: 6; /* length of pattern */ + uint w_hostlen : 4; /* length of host */ + uint w_done : 1; /* 1 if io confirmed done */ + uint w_async : 1; /* 1 if async write (writea) */ + uint w_extra2 : 28; /* EXTRA BITS IN WORD 2 */ +}; + +/* + * write log file datatype. wlog_open() initializes this structure + * which is then passed around to the various wlog_xxx routines. + */ + +struct wlog_file { + int w_afd; /* append fd */ + int w_rfd; /* random-access fd */ + char w_file[1024]; /* name of the write_log */ +}; + +/* + * return value defines for the user-supplied function to + * wlog_scan_backward(). + */ + +#define WLOG_STOP_SCAN 0 +#define WLOG_CONTINUE_SCAN 1 + +/* + * wlog prototypes + */ + +#if __STDC__ +extern int wlog_open(struct wlog_file *wfile, int trunc, int mode); +extern int wlog_close(struct wlog_file *wfile); +extern int wlog_record_write(struct wlog_file *wfile, + struct wlog_rec *wrec, long offset); +extern int wlog_scan_backward(struct wlog_file *wfile, int nrecs, + int (*func)(struct wlog_rec *rec), + long data); +#else +int wlog_open(); +int wlog_close(); +int wlog_record_write(); +int wlog_scan_backward(); +#endif + +extern char Wlog_Error_String[]; + +#endif /* _WRITE_LOG_H_ */ + -- cgit v1.2.3