summaryrefslogtreecommitdiff
path: root/tests/slow
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-12-19 16:40:59 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-12-20 10:18:57 +0100
commit011c3d964b1912151444527c4f92e8c752638126 (patch)
tree59b0cea0200a0fcd9cf86fa853eebc8cce949140 /tests/slow
parente59a3d4b166cf6773e6c2f425a0f03bf44006d08 (diff)
downloadgnutls-011c3d964b1912151444527c4f92e8c752638126.tar.gz
tests: hash-large: increase parallelism to allow fast run in CItmp-speedup-hash-tests
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/slow')
-rw-r--r--tests/slow/hash-large.c24
-rwxr-xr-xtests/slow/test-hash-large.sh81
2 files changed, 55 insertions, 50 deletions
diff --git a/tests/slow/hash-large.c b/tests/slow/hash-large.c
index 5c3fd2ce51..4c9846453e 100644
--- a/tests/slow/hash-large.c
+++ b/tests/slow/hash-large.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Nikos Mavrogiannopoulos
+ * Copyright (C) 2017 Red Hat, Inc.
*
* This file is part of GnuTLS.
*
@@ -13,9 +14,8 @@
* 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
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifdef HAVE_CONFIG_H
@@ -29,14 +29,15 @@
#include <limits.h>
#include "utils.h"
-#if defined(__FreeBSD__)
-/* its libc cannot handle that large allocations */
+#if defined(__FreeBSD__) || !defined(HAVE_MMAP)
void doit(void)
{
exit(77);
}
-#else /* not freebsd */
+#else /* working test */
+
+/* Test hashing on very large buffers >= 2^31 */
#if !defined(_WIN32)
# include <signal.h>
@@ -50,10 +51,6 @@ static void exit_77(int signo)
#define MIN(x,y) ((x)<(y))?(x):(y)
-/* Test hashing on large buffers */
-
-#ifdef HAVE_MMAP
-
#include <sys/mman.h>
static size_t _mmap_size;
@@ -72,13 +69,6 @@ static void put_mem(void *mem)
munmap(mem, _mmap_size);
}
-#else
-
-# define get_mem(x) calloc(1, x)
-# define put_mem(x) free(x)
-
-#endif
-
void doit(void)
{
unsigned char digest[32];
diff --git a/tests/slow/test-hash-large.sh b/tests/slow/test-hash-large.sh
index 74350b6686..750b0badbb 100755
--- a/tests/slow/test-hash-large.sh
+++ b/tests/slow/test-hash-large.sh
@@ -1,6 +1,7 @@
#!/bin/sh
# Copyright (C) 2016 Nikos Mavrogiannopoulos
+# Copyright (C) 2017 Red Hat, Inc.
#
# Author: Nikos Mavrogiannopoulos
#
@@ -16,9 +17,9 @@
# 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 GnuTLS; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
PROG=./hash-large${EXEEXT}
unset RETCODE
@@ -29,41 +30,55 @@ fi
srcdir="${srcdir:-.}"
. "${srcdir}/../scripts/common.sh"
-${PROG}
-ret=$?
-if test $ret != 0; then
- echo "default cipher tests failed"
- exit $ret
-fi
+run_test() {
+ GNUTLS_CPUID_OVERRIDE=$1 ${PROG}
+ ret=$?
+ if test $ret != 0; then
+ echo "tests failed for flags $1"
+ exit $ret
+ fi
+}
-GNUTLS_CPUID_OVERRIDE=0x1 ${PROG}
-ret=$?
-if test $ret != 0; then
- echo "included cipher tests failed"
- exit $ret
+#0x4: SSSE3
+#0x1: no optimizations
+#"": default optimizations
+
+SSSE3FLAG=""
+which lscpu >/dev/null 2>&1
+if test $? = 0;then
+ $(which lscpu)|grep Architecture|grep x86 >/dev/null
+ if test $? = 0;then
+ SSSE3FLAG="0x4"
+ fi
fi
-exit_if_non_x86
+WAITPID=""
+for flags in "" "0x1" ${SSSE3FLAG};do
+ run_test ${flags} &
+ WAITPID="${WAITPID} $!"
+done
-GNUTLS_CPUID_OVERRIDE=0x4 ${PROG}
-ret=$?
-if test $ret != 0; then
- echo "SSSE3 cipher tests failed"
- exit $ret
-fi
+for i in "$WAITPID";do
+ wait $i
+ ret=$?
+ test ${ret} != 0 && exit ${ret}
+done
-GNUTLS_CPUID_OVERRIDE=0x200000 ${PROG}
-ret=$?
-if test $ret != 0; then
- echo "padlock PHE cipher tests failed"
- exit $ret
-fi
+exit_if_non_padlock
-GNUTLS_CPUID_OVERRIDE=0x400000 ${PROG}
-ret=$?
-if test $ret != 0; then
- echo "padlock PHE SHA512 cipher tests failed"
- exit $ret
-fi
+#0x200000: Padlock PHE
+#0x400000: Padlock PHE SHA512
+
+WAITPID=""
+for flags in "0x200000" "0x400000";do
+ run_test ${flags} &
+ WAITPID="${WAITPID} $!"
+done
+
+for i in "$WAITPID";do
+ wait $i
+ ret=$?
+ test ${ret} != 0 && exit ${ret}
+done
exit 0