summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Greenan <kmgreen2@gmail.com>2013-12-07 16:00:12 -0800
committerKevin Greenan <kmgreen2@gmail.com>2013-12-07 16:05:31 -0800
commite1c76b4dd48a3ab323e20e94ebe984d7ded7c183 (patch)
tree6b2eb8b439f172375b73bc3e3332bf3a5196129f
parent87bb2604175e7471e05394782d2edb6fd05b4fa5 (diff)
downloadgf-complete-e1c76b4dd48a3ab323e20e94ebe984d7ded7c183.tar.gz
Added exhaustive test support (Ethan's changes to gf_unit and gf_methods) and overrode autoconf's defaults for CFLAGS.
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in4
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rw-r--r--examples/Makefile.am3
-rw-r--r--examples/Makefile.in3
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in4
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in3
-rw-r--r--test/gf_unit.c17
-rw-r--r--tools/Makefile.am3
-rw-r--r--tools/Makefile.in3
-rw-r--r--tools/gf_methods.c103
14 files changed, 90 insertions, 72 deletions
diff --git a/Makefile.am b/Makefile.am
index 09a0800..cac6246 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# Top-level GF-Complete AM file
+# Distributes headers
SUBDIRS = src tools test examples
ACLOCAL_AMFLAGS = -I m4
diff --git a/Makefile.in b/Makefile.in
index 3a0ed69..61e0924 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,8 +15,8 @@
@SET_MAKE@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# Top-level GF-Complete AM file
+# Distributes headers
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/configure b/configure
index 2640c92..39b0d81 100755
--- a/configure
+++ b/configure
@@ -10972,6 +10972,10 @@ ac_config_headers="$ac_config_headers include/config.h"
+# Override default CFLAGS
+CFLAGS="-O3 -g"
+CXXFLAGS="-O3 -g"
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/configure.ac b/configure.ac
index 96c8f62..826c681 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,10 @@ AC_CONFIG_HEADER(include/config.h)
dnl Needed when reconfiguring with 'autoreconf -i -s'
AC_CONFIG_MACRO_DIR([m4])
+# Override default CFLAGS
+CFLAGS="-O3 -g"
+CXXFLAGS="-O3 -g"
+
dnl Compiling with per-target flags requires AM_PROG_CC_C_O.
AC_PROG_CC
diff --git a/examples/Makefile.am b/examples/Makefile.am
index c8d7486..fa8ca5a 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,5 +1,4 @@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'examples' AM file
INCLUDES=-I./ -I../include
AM_CFLAGS = -O3 $(SIMD_FLAGS) -fPIC $(INCLUDES)
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 3f5c100..eaa4fbc 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -15,8 +15,7 @@
@SET_MAKE@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'examples' AM file
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/src/Makefile.am b/src/Makefile.am
index 38217c7..4dee612 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'core' AM file
+# Creates the library
INCLUDES=-I./ -I../include
AM_CFLAGS = -O3 $(SIMD_FLAGS) -fPIC $(INCLUDES)
diff --git a/src/Makefile.in b/src/Makefile.in
index 4530d8a..763b17a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -15,8 +15,8 @@
@SET_MAKE@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'core' AM file
+# Creates the library
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/test/Makefile.am b/test/Makefile.am
index f2e7f90..443fc3e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,4 @@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'test' AM file
INCLUDES=-I./ -I../include
AM_CFLAGS = -O3 $(SIMD_FLAGS) -fPIC $(INCLUDES)
diff --git a/test/Makefile.in b/test/Makefile.in
index 0b994b0..acd5996 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -15,8 +15,7 @@
@SET_MAKE@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'test' AM file
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/test/gf_unit.c b/test/gf_unit.c
index 434763d..cf466fe 100644
--- a/test/gf_unit.c
+++ b/test/gf_unit.c
@@ -22,7 +22,7 @@
#include "gf_rand.h"
#include "gf_general.h"
-#define REGION_SIZE (16384)
+#define REGION_SIZE (16384)
#define RMASK (0x00000000ffffffffLL)
#define LMASK (0xffffffff00000000LL)
@@ -38,7 +38,7 @@ char *BM = "Bad Method: ";
void usage(char *s)
{
fprintf(stderr, "usage: gf_unit w tests seed [method] - does unit testing in GF(2^w)\n");
- fprintf(stderr, "\n");
+ fprintf(stderr, "\n");
fprintf(stderr, "Legal w are: 1 - 32, 64 and 128\n");
fprintf(stderr, " 128 is hex only (i.e. '128' will be an error - do '128h')\n");
fprintf(stderr, "\n");
@@ -95,9 +95,16 @@ int main(int argc, char **argv)
MOA_Seed(t0);
if (w > 32 && w != 64 && w != 128) usage("Bad w");
-
- if (create_gf_from_argv(&gf, w, argc, argv, 4) == 0) usage(BM);
- printf("Size (bytes): %d\n", gf_size(&gf));
+
+ if (create_gf_from_argv(&gf, w, argc, argv, 4) == 0) {
+ usage(BM);
+ }
+
+ printf("Args: ");
+ for (i = 1; i < argc; i++) {
+ printf ("%s ", argv[i]);
+ }
+ printf("/ size (bytes): %d\n", gf_size(&gf));
for (i = 0; i < strlen(argv[2]); i++) {
if (strchr("ASRV", argv[2][i]) == NULL) usage("Bad test\n");
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c357ea3..31dffae 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,5 +1,4 @@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'tools' AM file
INCLUDES=-I./ -I../include
AM_CFLAGS = -O3 $(SIMD_FLAGS) -fPIC $(INCLUDES)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 6d276fb..9bba8c7 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -15,8 +15,7 @@
@SET_MAKE@
-# GF-Complete AM file
-# Only creates library and distributes header files
+# GF-Complete 'tools' AM file
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/tools/gf_methods.c b/tools/gf_methods.c
index 147e7e7..90ddd15 100644
--- a/tools/gf_methods.c
+++ b/tools/gf_methods.c
@@ -29,18 +29,27 @@ static char *regions[NREGIONS] = { "DOUBLE", "QUAD", "LAZY", "SSE", "NOSSE",
#define NDIVS (2)
static char *divides[NDIVS] = { "MATRIX", "EUCLID" };
-int main()
+
+int main(int argc, char *argv[])
{
int m, r, d, w, i, sa, j, k, reset;
- char *argv[50];
+ char *gf_argv[50];
gf_t gf;
char divs[200], ks[10], ls[10];
-
+ char * w_str = "w=%d:";
+
+ if (argc == 2) {
+ if (!strcmp (argv[1], "-U")) {
+ w_str = "%d A -1";
+ }
+ }
+
for (i = 2; i < 8; i++) {
w = (1 << i);
- argv[0] = "-";
- if (create_gf_from_argv(&gf, w, 1, argv, 0) > 0) {
- printf("w=%d: -\n", w);
+ gf_argv[0] = "-";
+ if (create_gf_from_argv(&gf, w, 1, gf_argv, 0) > 0) {
+ printf(w_str, w);
+ printf(" - \n");
gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d: -\n", 2);
@@ -49,83 +58,83 @@ int main()
for (m = 0; m < NMULTS; m++) {
sa = 0;
- argv[sa++] = "-m";
+ gf_argv[sa++] = "-m";
if (strcmp(mults[m], "GROUP44") == 0) {
- argv[sa++] = "GROUP";
- argv[sa++] = "4";
- argv[sa++] = "4";
+ gf_argv[sa++] = "GROUP";
+ gf_argv[sa++] = "4";
+ gf_argv[sa++] = "4";
} else if (strcmp(mults[m], "GROUP48") == 0) {
- argv[sa++] = "GROUP";
- argv[sa++] = "4";
- argv[sa++] = "8";
+ gf_argv[sa++] = "GROUP";
+ gf_argv[sa++] = "4";
+ gf_argv[sa++] = "8";
} else if (strcmp(mults[m], "SPLIT2") == 0) {
- argv[sa++] = "SPLIT";
+ gf_argv[sa++] = "SPLIT";
sprintf(ls, "%d", w);
- argv[sa++] = ls;
- argv[sa++] = "2";
+ gf_argv[sa++] = ls;
+ gf_argv[sa++] = "2";
} else if (strcmp(mults[m], "SPLIT4") == 0) {
- argv[sa++] = "SPLIT";
+ gf_argv[sa++] = "SPLIT";
sprintf(ls, "%d", w);
- argv[sa++] = ls;
- argv[sa++] = "4";
+ gf_argv[sa++] = ls;
+ gf_argv[sa++] = "4";
} else if (strcmp(mults[m], "SPLIT8") == 0) {
- argv[sa++] = "SPLIT";
+ gf_argv[sa++] = "SPLIT";
sprintf(ls, "%d", w);
- argv[sa++] = ls;
- argv[sa++] = "8";
+ gf_argv[sa++] = ls;
+ gf_argv[sa++] = "8";
} else if (strcmp(mults[m], "SPLIT16") == 0) {
- argv[sa++] = "SPLIT";
+ gf_argv[sa++] = "SPLIT";
sprintf(ls, "%d", w);
- argv[sa++] = ls;
- argv[sa++] = "16";
+ gf_argv[sa++] = ls;
+ gf_argv[sa++] = "16";
} else if (strcmp(mults[m], "SPLIT88") == 0) {
- argv[sa++] = "SPLIT";
- argv[sa++] = "8";
- argv[sa++] = "8";
+ gf_argv[sa++] = "SPLIT";
+ gf_argv[sa++] = "8";
+ gf_argv[sa++] = "8";
} else if (strcmp(mults[m], "COMPOSITE") == 0) {
- argv[sa++] = "COMPOSITE";
- argv[sa++] = "2";
- argv[sa++] = "-";
+ gf_argv[sa++] = "COMPOSITE";
+ gf_argv[sa++] = "2";
+ gf_argv[sa++] = "-";
} else {
- argv[sa++] = mults[m];
+ gf_argv[sa++] = mults[m];
}
reset = sa;
for (r = 0; r < (1 << NREGIONS); r++) {
sa = reset;
for (k = 0; k < NREGIONS; k++) {
if (r & 1 << k) {
- argv[sa++] = "-r";
- argv[sa++] = regions[k];
+ gf_argv[sa++] = "-r";
+ gf_argv[sa++] = regions[k];
}
}
- argv[sa++] = "-";
- if (create_gf_from_argv(&gf, w, sa, argv, 0) > 0) {
- printf("w=%d:", w);
- for (j = 0; j < sa; j++) printf(" %s", argv[j]);
+ gf_argv[sa++] = "-";
+ if (create_gf_from_argv(&gf, w, sa, gf_argv, 0) > 0) {
+ printf(w_str, w);
+ for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n");
gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w);
- for (j = 0; j < sa; j++) fprintf(stderr, " %s", argv[j]);
+ for (j = 0; j < sa; j++) fprintf(stderr, " %s", gf_argv[j]);
fprintf(stderr, "\n");
exit(1);
}
sa--;
for (d = 0; d < NDIVS; d++) {
- argv[sa++] = "-d";
- argv[sa++] = divides[d];
+ gf_argv[sa++] = "-d";
+ gf_argv[sa++] = divides[d];
/* printf("w=%d:", w);
- for (j = 0; j < sa; j++) printf(" %s", argv[j]);
+ for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n"); */
- argv[sa++] = "-";
- if (create_gf_from_argv(&gf, w, sa, argv, 0) > 0) {
- printf("w=%d:", w);
- for (j = 0; j < sa; j++) printf(" %s", argv[j]);
+ gf_argv[sa++] = "-";
+ if (create_gf_from_argv(&gf, w, sa, gf_argv, 0) > 0) {
+ printf(w_str, w);
+ for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n");
gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w);
- for (j = 0; j < sa; j++) fprintf(stderr, " %s", argv[j]);
+ for (j = 0; j < sa; j++) fprintf(stderr, " %s", gf_argv[j]);
fprintf(stderr, "\n");
exit(1);
}