File: sparse-xarray-test.at

package info (click to toggle)
pspp 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,676 kB
  • sloc: ansic: 267,210; xml: 18,446; sh: 5,534; python: 2,881; makefile: 125; perl: 64
file content (101 lines) | stat: -rw-r--r-- 3,632 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
dnl
AT_BANNER([sparse external arrays])

m4_divert_push([PREPARE_TESTS])
[sparse_xarray_queue_limit () {
  # Each on-disk sparse_xarray eats up a file descriptor, so for the
  # tests that involve on-disk sparse_xarrays we need to limit the
  # maximum length of the queue.  Figure out how many file descriptors
  # we can let the test program open at once.
  OPEN_MAX=`getconf OPEN_MAX 2>/dev/null`
  case $OPEN_MAX in
    [0-9]*)
      # Divide by 2 because some fds are used by other code.
      queue_limit=`expr $OPEN_MAX / 2`
      ;;
    undefined)
      # Assume that any system with a dynamic fd limit has a large limit.
      queue_limit=500
      ;;
    *)
      case `uname -m 2>/dev/null` in
	CYGWIN*)
	  # Cygwin claims a 256-fd limit as OPEN_MAX in <limits.h>.
	  queue_limit=128
	  ;;
	MINGW*)
	  # The following email claims that Mingw should have a
	  # 2048-fd limit:
	  # http://www.mail-archive.com/squid-users@squid-cache.org/msg35249.html
	  queue_limit=1024
	  ;;
	*)
	  # This seems fairly conservative these days.
	  queue_limit=50
	  ;;
      esac
      ;;
  esac
  echo "$queue_limit"
}]
m4_divert_pop([PREPARE_TESTS])

AT_SETUP([in-memory sparse_xarray])
AT_KEYWORDS([slow])
dnl --values=3 would be a slightly better test but takes much longer.
AT_CHECK([sparse-xarray-test \
	    --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
	    --columns=3 --max-rows=3 --max-memory-rows=3 --values=2],
  [0], [ignore], [ignore])
AT_CLEANUP

m4_define([SPARSE_XARRAY_ON_DISK],
  [AT_SETUP([on-disk sparse_xarray max-memory-rows=$1])
   AT_KEYWORDS([slow])
   AT_CHECK([sparse-xarray-test \
	       --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
               --columns=2 --max-rows=3 --max-memory-rows=$1 --values=2],
     [0], [ignore], [ignore])
   AT_CLEANUP])
SPARSE_XARRAY_ON_DISK([0])
SPARSE_XARRAY_ON_DISK([1])
SPARSE_XARRAY_ON_DISK([2])

AT_SETUP([copying between in-memory sparse_xarrays])
AT_KEYWORDS([sparse_xarray slow])
AT_CHECK([sparse-xarray-test \
	    --verbosity=0 --queue-limit=`sparse_xarray_queue_limit` \
 	    --columns=2 --max-rows=2 --max-memory-rows=2 --values=2 \
	    --xarrays=2 --no-write-rows --no-copy-columns],
  [0], [ignore], [ignore])
AT_CLEANUP

m4_define([SPARSE_XARRAY_COPY_DISK],
  [AT_SETUP([copying between on-disk sparse_xarrays max-memory-rows=$1])
   AT_KEYWORDS([sparse_xarray slow])
   limit=`sparse_xarray_queue_limit`
   AT_CHECK([sparse-xarray-test \
               --verbosity=0 --queue-limit=`expr $limit / 2` \
	       --columns=1 --max-rows=2 --max-memory-rows=$max_memory_rows \
	       --values=2 --xarrays=2 --no-write-rows --no-copy-columns],
            [0], [ignore], [ignore])
   AT_CLEANUP])
dnl These parameters are ridiculously low, but it's necessary
dnl unless we want the tests to take a very long time.
SPARSE_XARRAY_COPY_DISK([0])
SPARSE_XARRAY_COPY_DISK([1])