1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
17 AT_BANNER([sparse external arrays])
19 m4_divert_push([PREPARE_TESTS])
20 [sparse_xarray_queue_limit () {
21 # Each on-disk sparse_xarray eats up a file descriptor, so for the
22 # tests that involve on-disk sparse_xarrays we need to limit the
23 # maximum length of the queue. Figure out how many file descriptors
24 # we can let the test program open at once.
25 OPEN_MAX=`getconf OPEN_MAX 2>/dev/null`
28 # Divide by 2 because some fds are used by other code.
29 queue_limit=`expr $OPEN_MAX / 2`
32 # Assume that any system with a dynamic fd limit has a large limit.
36 case `uname -m 2>/dev/null` in
38 # Cygwin claims a 256-fd limit as OPEN_MAX in <limits.h>.
42 # The following email claims that Mingw should have a
44 # http://www.mail-archive.com/squid-users@squid-cache.org/msg35249.html
48 # This seems fairly conservative these days.
56 m4_divert_pop([PREPARE_TESTS])
58 AT_SETUP([in-memory sparse_xarray])
60 dnl --values=3 would be a slightly better test but takes much longer.
61 ASAN_OPTIONS=$ASAN_OPTIONS:detect_odr_violation=0; export ASAN_OPTIONS
62 AT_CHECK([sparse-xarray-test \
63 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
64 --columns=3 --max-rows=3 --max-memory-rows=3 --values=2],
65 [0], [ignore], [ignore])
68 m4_define([SPARSE_XARRAY_ON_DISK],
69 [AT_SETUP([on-disk sparse_xarray max-memory-rows=$1])
71 ASAN_OPTIONS=$ASAN_OPTIONS:detect_odr_violation=0; export ASAN_OPTIONS
72 AT_CHECK([sparse-xarray-test \
73 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
74 --columns=2 --max-rows=3 --max-memory-rows=$1 --values=2],
75 [0], [ignore], [ignore])
77 SPARSE_XARRAY_ON_DISK([0])
78 SPARSE_XARRAY_ON_DISK([1])
79 SPARSE_XARRAY_ON_DISK([2])
81 AT_SETUP([copying between in-memory sparse_xarrays])
82 AT_KEYWORDS([sparse_xarray slow])
83 ASAN_OPTIONS=$ASAN_OPTIONS:detect_odr_violation=0; export ASAN_OPTIONS
84 AT_CHECK([sparse-xarray-test \
85 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
86 --columns=2 --max-rows=2 --max-memory-rows=2 --values=2 \
87 --xarrays=2 --no-write-rows --no-copy-columns],
88 [0], [ignore], [ignore])
91 m4_define([SPARSE_XARRAY_COPY_DISK],
92 [AT_SETUP([copying between on-disk sparse_xarrays max-memory-rows=$1])
93 AT_KEYWORDS([sparse_xarray slow])
94 limit=`sparse_xarray_queue_limit`
95 ASAN_OPTIONS=$ASAN_OPTIONS:detect_odr_violation=0; export ASAN_OPTIONS
96 AT_CHECK([sparse-xarray-test \
97 --verbosity=0 --queue-limit=`expr $limit / 2` \
98 --columns=1 --max-rows=2 --max-memory-rows=$max_memory_rows \
99 --values=2 --xarrays=2 --no-write-rows --no-copy-columns],
100 [0], [ignore], [ignore])
102 dnl These parameters are ridiculously low, but it's necessary
103 dnl unless we want the tests to take a very long time.
104 SPARSE_XARRAY_COPY_DISK([0])
105 SPARSE_XARRAY_COPY_DISK([1])