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 AT_CHECK([sparse-xarray-test \
62 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
63 --columns=3 --max-rows=3 --max-memory-rows=3 --values=2],
64 [0], [ignore], [ignore])
67 m4_define([SPARSE_XARRAY_ON_DISK],
68 [AT_SETUP([on-disk sparse_xarray max-memory-rows=$1])
70 AT_CHECK([sparse-xarray-test \
71 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
72 --columns=2 --max-rows=3 --max-memory-rows=$1 --values=2],
73 [0], [ignore], [ignore])
75 SPARSE_XARRAY_ON_DISK([0])
76 SPARSE_XARRAY_ON_DISK([1])
77 SPARSE_XARRAY_ON_DISK([2])
79 AT_SETUP([copying between in-memory sparse_xarrays])
80 AT_KEYWORDS([sparse_xarray slow])
81 AT_CHECK([sparse-xarray-test \
82 --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
83 --columns=2 --max-rows=2 --max-memory-rows=2 --values=2 \
84 --xarrays=2 --no-write-rows --no-copy-columns],
85 [0], [ignore], [ignore])
88 m4_define([SPARSE_XARRAY_COPY_DISK],
89 [AT_SETUP([copying between on-disk sparse_xarrays max-memory-rows=$1])
90 AT_KEYWORDS([sparse_xarray slow])
91 limit=`sparse_xarray_queue_limit`
92 AT_CHECK([sparse-xarray-test \
93 --verbosity=0 --queue-limit=`expr $limit / 2` \
94 --columns=1 --max-rows=2 --max-memory-rows=$max_memory_rows \
95 --values=2 --xarrays=2 --no-write-rows --no-copy-columns],
96 [0], [ignore], [ignore])
98 dnl These parameters are ridiculously low, but it's necessary
99 dnl unless we want the tests to take a very long time.
100 SPARSE_XARRAY_COPY_DISK([0])
101 SPARSE_XARRAY_COPY_DISK([1])