Added exhaustive test support (Ethan's changes to gf_unit and gf_methods) and overrode autoconf's defaults for CFLAGS.
parent
87bb260417
commit
e1c76b4dd4
|
@ -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
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue