Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9d38c1b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,101 @@
+#
+# Copyright (c) 2010-2011 Nest, Inc.
+# All rights reserved.
+#
+# This document is the property of Nest. It is considered
+# confidential and proprietary information.
+#
+# This document may not be reproduced or transmitted in any form,
+# in whole or in part, without the express written permission of
+# Nest.
+#
+# Description:
+# This file is the make file for memtester, a portable userspace
+# utility for testing the memory subsystem for faults.
+#
+
+
+include pre.mak
+
+PackageName := memtester
+
+PackageExtension := tar.gz
+PackageSeparator := -
+
+PackagePatchArgs :=
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
+
+CleanPaths += $(PackageLicenseFile)
+
+SOURCEDIRS = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/COPYING: $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(PackageSourceDir)/COPYING
+ $(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+ $(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir) $(BuildDirectory)
+ $(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+ $(Verbose)touch $@
+
+# Generate the package build makefile.
+
+$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
+ $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source $(PackageBuildMakefile)
+ $(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure | $(BuildDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ CC="$(CC) $(CPPOPTFLAGS) $(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
+ all
+ $(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ INSTALLPATH=$(ResultDirectory) \
+ install
+ $(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+ $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/memtester.patches/memtester-50.description b/memtester.patches/memtester-50.description
new file mode 100644
index 0000000..4a1b4fb
--- /dev/null
+++ b/memtester.patches/memtester-50.description
@@ -0,0 +1 @@
+This patch simplifies the build of memtester by eliminating all of its compiler and linker indirection scripts that completely prevent building memtester in a cross-compiled environment.
diff --git a/memtester.patches/memtester-50.patch b/memtester.patches/memtester-50.patch
new file mode 100644
index 0000000..aa14a36
--- /dev/null
+++ b/memtester.patches/memtester-50.patch
@@ -0,0 +1,35 @@
+diff -aruN a/Makefile b/Makefile
+--- a/Makefile 2010-10-03 12:56:13.000000000 -0700
++++ b/Makefile 2010-11-02 17:21:36.093700129 -0700
+@@ -7,11 +7,8 @@
+ # COPYING for details.
+ #
+
+-# You don't need to edit these; change the contents of the conf-cc and conf-ld
+-# files if you need to change the compile/link commands. See the README for
+-# more information.
+-CC = $(shell head -n 1 conf-cc)
+-LD = $(shell head -n 1 conf-ld)
++compile = $(CC) -O2 -DPOSIX -D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64 -DTEST_NARROW_WRITES -c
++link = $(CC) -o
+
+ SOURCES = memtester.c tests.c
+ OBJECTS = $(SOURCES:.c=.o)
+@@ -74,11 +71,11 @@
+ rm -f memtester $(TARGETS) $(OBJECTS) core
+
+ memtester: \
+-$(OBJECTS) memtester.c tests.h tests.c tests.h conf-cc Makefile load extra-libs
+- ./load memtester tests.o `cat extra-libs`
++$(OBJECTS) memtester.c tests.h tests.c tests.h Makefile
++ $(link) memtester memtester.o tests.o
+
+-memtester.o: memtester.c tests.h conf-cc Makefile compile
+- ./compile memtester.c
++memtester.o: memtester.c tests.h Makefile
++ $(compile) memtester.c
+
+-tests.o: tests.c tests.h conf-cc Makefile compile
+- ./compile tests.c
++tests.o: tests.c tests.h Makefile
++ $(compile) tests.c
diff --git a/memtester.patches/memtester-51.description b/memtester.patches/memtester-51.description
new file mode 100644
index 0000000..ad9e531
--- /dev/null
+++ b/memtester.patches/memtester-51.description
@@ -0,0 +1 @@
+This patch addresses an issue in which, on Ubuntu 11 and later, sh is not an alias of bash. Consequently, bashisms such as file interpolation do not work correctly.
diff --git a/memtester.patches/memtester-51.patch b/memtester.patches/memtester-51.patch
new file mode 100644
index 0000000..77e5bd7
--- /dev/null
+++ b/memtester.patches/memtester-51.patch
@@ -0,0 +1,13 @@
+diff -aruN a/Makefile b/Makefile
+--- a/Makefile 2012-09-10 15:51:24.061610646 -0700
++++ b/Makefile 2012-09-10 15:51:02.872463701 -0700
+@@ -22,7 +22,8 @@
+ all: memtester
+
+ install: all
+- mkdir -m 755 -p $(INSTALLPATH)/{bin,man/man8}
++ mkdir -m 755 -p $(INSTALLPATH)/bin
++ mkdir -m 755 -p $(INSTALLPATH)/man/man8
+ install -m 755 memtester $(INSTALLPATH)/bin/
+ gzip -c memtester.8 >memtester.8.gz ; install -m 644 memtester.8.gz $(INSTALLPATH)/man/man8/
+
diff --git a/memtester.patches/memtester-52.description b/memtester.patches/memtester-52.description
new file mode 100644
index 0000000..cf6fe3b
--- /dev/null
+++ b/memtester.patches/memtester-52.description
@@ -0,0 +1 @@
+Add early exit on failure and a "fail" status to the standard output.
diff --git a/memtester.patches/memtester-52.patch b/memtester.patches/memtester-52.patch
new file mode 100644
index 0000000..fd54ba7
--- /dev/null
+++ b/memtester.patches/memtester-52.patch
@@ -0,0 +1,66 @@
+diff -aruN a/memtester.c b/memtester.c
+--- a/memtester.c 2017-04-13 12:13:53.101455795 -0700
++++ b/memtester.c 2017-04-13 12:21:38.423324655 -0700
+@@ -100,7 +100,9 @@
+
+ /* Function definitions */
+ void usage(char *me) {
+- fprintf(stderr, "\nUsage: %s [-p physaddrbase] <mem>[B|K|M|G] [loops]\n", me);
++ fprintf(stderr, "\nUsage: %s [-e] [-p physaddrbase] <mem>[B|K|M|G] [loops]\n", me);
++ fprintf(stderr, "Arguments:\n");
++ fprintf(stderr, " -e Exit on error.\n");
+ exit(EXIT_FAIL_NONSTARTER);
+ }
+
+@@ -113,6 +115,7 @@
+ void volatile *buf, *aligned;
+ ulv *bufa, *bufb;
+ int do_mlock = 1, done_mem = 0;
++ int exit_on_err = 0;
+ int exit_code = 0;
+ int memfd, opt, memshift;
+ size_t maxbytes = -1; /* addressable memory, in bytes */
+@@ -127,7 +130,7 @@
+ pagesizemask = (ptrdiff_t) ~(pagesize - 1);
+ printf("pagesizemask is 0x%tx\n", pagesizemask);
+
+- while ((opt = getopt(argc, argv, "p:")) != -1) {
++ while ((opt = getopt(argc, argv, "ep:")) != -1) {
+ switch (opt) {
+ case 'p':
+ errno = 0;
+@@ -154,6 +157,9 @@
+ /* okay, got address */
+ use_phys = 1;
+ break;
++ case 'e':
++ exit_on_err = 1;
++ break;
+ default: /* '?' */
+ usage(argv[0]); /* doesn't return */
+ }
+@@ -322,6 +328,7 @@
+ if (!test_stuck_address(aligned, bufsize / sizeof(ul))) {
+ printf("ok\n");
+ } else {
++ printf("fail\n");
+ exit_code |= EXIT_FAIL_ADDRESSLINES;
+ }
+ for (i=0;;i++) {
+@@ -330,12 +337,16 @@
+ if (!tests[i].fp(bufa, bufb, count)) {
+ printf("ok\n");
+ } else {
++ printf("fail\n");
+ exit_code |= EXIT_FAIL_OTHERTEST;
+ }
+ fflush(stdout);
+ }
+ printf("\n");
+ fflush(stdout);
++ if (exit_on_err && (exit_code != 0)) {
++ break;
++ }
+ }
+ if (do_mlock) munlock((void *) aligned, bufsize);
+ printf("Done.\n");
diff --git a/memtester.tar.gz b/memtester.tar.gz
new file mode 100644
index 0000000..ca21e55
--- /dev/null
+++ b/memtester.tar.gz
Binary files differ
diff --git a/memtester.url b/memtester.url
new file mode 100644
index 0000000..333eb54
--- /dev/null
+++ b/memtester.url
@@ -0,0 +1 @@
+http://pyropus.ca/software/memtester/old-versions/memtester-4.2.1.tar.gz
diff --git a/memtester.version b/memtester.version
new file mode 100644
index 0000000..fae6e3d
--- /dev/null
+++ b/memtester.version
@@ -0,0 +1 @@
+4.2.1