diff --git a/configure.ac b/configure.ac index 224abf8..652852f 100755 --- a/configure.ac +++ b/configure.ac @@ -232,11 +232,14 @@ AC_ARG_WITH([json], if test "x$search_json" = "xyes"; then # use pkg only + # FIXME: search _have_json="yes" LDFLAGS="$LDFLAGS -ljansson" CFLAGS="$CFLAGS -DHAVE_JSON=1" fi +AM_CONDITIONAL([BUILDJSON], [test "x$_have_json" = "xyes"]) + # Check for some target-specific stuff case "$host" in diff --git a/include/pcp/config.h.in b/include/pcp/config.h.in new file mode 100644 index 0000000..b53de92 --- /dev/null +++ b/include/pcp/config.h.in @@ -0,0 +1,191 @@ +/* include/pcp/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `arc4random' function. */ +#undef HAVE_ARC4RANDOM + +/* Define to 1 if you have the `arc4random_buf' function. */ +#undef HAVE_ARC4RANDOM_BUF + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define if be32toh() is available */ +#undef HAVE_BE32TOH + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERR_H + +/* Define to 1 if you have the `fopen' function. */ +#undef HAVE_FOPEN + +/* Define to 1 if you have the `fprintf' function. */ +#undef HAVE_FPRINTF + +/* Define to 1 if you have the `fread' function. */ +#undef HAVE_FREAD + +/* Define to 1 if you have the `free' function. */ +#undef HAVE_FREE + +/* Define to 1 if you have the `fseek' function. */ +#undef HAVE_FSEEK + +/* Define to 1 if you have the `ftruncate' function. */ +#undef HAVE_FTRUNCATE + +/* Define to 1 if you have the `fwrite' function. */ +#undef HAVE_FWRITE + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define if htobe32() is available */ +#undef HAVE_HTOBE32 + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isatty' function. */ +#undef HAVE_ISATTY + +/* Define to 1 if you have the `sodium' library (-lsodium). */ +#undef HAVE_LIBSODIUM + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `malloc' function. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN + +/* Define to 1 if you have the `setrlimit' function. */ +#undef HAVE_SETRLIMIT + +/* Define to 1 if you have the `sizeof' function. */ +#undef HAVE_SIZEOF + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_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_STDIO_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 you have the `strlen' function. */ +#undef HAVE_STRLEN + +/* Define to 1 if you have the `strnlen' function. */ +#undef HAVE_STRNLEN + +/* Define to 1 if you have the `strnstr' function. */ +#undef HAVE_STRNSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ENDIAN_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 `tcgetattr' function. */ +#undef HAVE_TCGETATTR + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the `towlower' function. */ +#undef HAVE_TOWLOWER + +/* Define to 1 if you have the `umask' function. */ +#undef HAVE_UMASK + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* 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 home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/tests/Makefile.am b/tests/Makefile.am index f40b574..a3ad79d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -24,6 +24,10 @@ if BUILDCPP CPPTEST=cpptest endif +if BUILDJSON + MAYJSON=jsontest +endif + AM_CFLAGS = -I../include/pcp -I../src -I../libpcp/scrypt/crypto check_PROGRAMS = invalidkeys gencheader statictest $(CPPTEST) \ buffertest sample streamtest pipetest decodertest mangle @@ -83,7 +87,10 @@ if BUILDPY MAYPY=pytest endif -test: check ctest $(MAYPY) $(MAYCPP) +et: + @echo check ctest $(MAYPY) $(MAYCPP) $(MAYJSON) + +test: check ctest $(MAYPY) $(MAYCPP) $(MAYJSON) ctest: rm -f test* v* stresstest/* @@ -96,6 +103,9 @@ pytest: docpptest: ./unittests.pl cppunittests.cfg $(CHECK) +jsontest: + ./unittests.pl jsonunittests.cfg $(CHECK) + stresstest: check ./unittests.pl stresstests.cfg diff --git a/tests/jsonunittests.cfg b/tests/jsonunittests.cfg new file mode 100644 index 0000000..f8251cf --- /dev/null +++ b/tests/jsonunittests.cfg @@ -0,0 +1,61 @@ +# -*-html-*- +# +# This file is part of Pretty Curved Privacy (pcp1). +# +# Copyright (C) 2013 T.Linden. +# +# 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 3 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, see . +# +# You can contact me by mail: . +# + +pcp = ../src/pcp1 +passwd = xxx +verbose = 1 +include keys.cfg + + + prepare = rm -f vja; $pcp -V vja -K -I key-alicia-sec -x a + + cmd = $pcp -V vja -p -j -x a -O testkeyvjapub.json + expect-file testkeyvjapub.json + + + cmd = cat testkeyvjapub.json + expect = /"Alicia"/ + + + + + prepare = rm -f vjb; $pcp -V vjb -K -I key-bobby-sec -x b + + cmd = $pcp -V vjb -K -I testkeyvjapub.json -j + expect /added/ + + + + + + cmd = $pcp -V vjb -t -j + expect = /"Alicia"/ + + + cmd = $pcp -V vjb -t -j -i ${idalicia} + expect = /"Alicia"/ + + + cmd = $pcp -V vjb -t -j -i ${idbobby} + expect = /"Bobby"/ + +