~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/ft/tests/subblock-test-size.cc

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
 
3
// test the choose sub block size function
 
4
#ident "$Id$"
 
5
/*
 
6
COPYING CONDITIONS NOTICE:
 
7
 
 
8
  This program is free software; you can redistribute it and/or modify
 
9
  it under the terms of version 2 of the GNU General Public License as
 
10
  published by the Free Software Foundation, and provided that the
 
11
  following conditions are met:
 
12
 
 
13
      * Redistributions of source code must retain this COPYING
 
14
        CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
 
15
        DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
 
16
        PATENT MARKING NOTICE (below), and the PATENT RIGHTS
 
17
        GRANT (below).
 
18
 
 
19
      * Redistributions in binary form must reproduce this COPYING
 
20
        CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
 
21
        DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
 
22
        PATENT MARKING NOTICE (below), and the PATENT RIGHTS
 
23
        GRANT (below) in the documentation and/or other materials
 
24
        provided with the distribution.
 
25
 
 
26
  You should have received a copy of the GNU General Public License
 
27
  along with this program; if not, write to the Free Software
 
28
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
29
  02110-1301, USA.
 
30
 
 
31
COPYRIGHT NOTICE:
 
32
 
 
33
  TokuDB, Tokutek Fractal Tree Indexing Library.
 
34
  Copyright (C) 2007-2013 Tokutek, Inc.
 
35
 
 
36
DISCLAIMER:
 
37
 
 
38
  This program is distributed in the hope that it will be useful, but
 
39
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
40
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
41
  General Public License for more details.
 
42
 
 
43
UNIVERSITY PATENT NOTICE:
 
44
 
 
45
  The technology is licensed by the Massachusetts Institute of
 
46
  Technology, Rutgers State University of New Jersey, and the Research
 
47
  Foundation of State University of New York at Stony Brook under
 
48
  United States of America Serial No. 11/760379 and to the patents
 
49
  and/or patent applications resulting from it.
 
50
 
 
51
PATENT MARKING NOTICE:
 
52
 
 
53
  This software is covered by US Patent No. 8,185,551.
 
54
  This software is covered by US Patent No. 8,489,638.
 
55
 
 
56
PATENT RIGHTS GRANT:
 
57
 
 
58
  "THIS IMPLEMENTATION" means the copyrightable works distributed by
 
59
  Tokutek as part of the Fractal Tree project.
 
60
 
 
61
  "PATENT CLAIMS" means the claims of patents that are owned or
 
62
  licensable by Tokutek, both currently or in the future; and that in
 
63
  the absence of this license would be infringed by THIS
 
64
  IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
 
65
 
 
66
  "PATENT CHALLENGE" shall mean a challenge to the validity,
 
67
  patentability, enforceability and/or non-infringement of any of the
 
68
  PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
 
69
 
 
70
  Tokutek hereby grants to you, for the term and geographical scope of
 
71
  the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
 
72
  irrevocable (except as stated in this section) patent license to
 
73
  make, have made, use, offer to sell, sell, import, transfer, and
 
74
  otherwise run, modify, and propagate the contents of THIS
 
75
  IMPLEMENTATION, where such license applies only to the PATENT
 
76
  CLAIMS.  This grant does not include claims that would be infringed
 
77
  only as a consequence of further modifications of THIS
 
78
  IMPLEMENTATION.  If you or your agent or licensee institute or order
 
79
  or agree to the institution of patent litigation against any entity
 
80
  (including a cross-claim or counterclaim in a lawsuit) alleging that
 
81
  THIS IMPLEMENTATION constitutes direct or contributory patent
 
82
  infringement, or inducement of patent infringement, then any rights
 
83
  granted to you under this License shall terminate as of the date
 
84
  such litigation is filed.  If you or your agent or exclusive
 
85
  licensee institute or order or agree to the institution of a PATENT
 
86
  CHALLENGE, then Tokutek may terminate any rights granted to you
 
87
  under this License.
 
88
*/
 
89
 
 
90
#ident "Copyright (c) 2007-2013 Tokutek Inc.  All rights reserved."
 
91
 
 
92
#include <toku_portability.h>
 
93
#include "test.h"
 
94
#include <stdio.h>
 
95
#include <errno.h>
 
96
#include <string.h>
 
97
 
 
98
#include "sub_block.h"
 
99
 
 
100
static void
 
101
test_sub_block_size(int total_size) {
 
102
    if (verbose)
 
103
        printf("%s:%d %d\n", __FUNCTION__, __LINE__, total_size);
 
104
    int r;
 
105
    int sub_block_size, n_sub_blocks;
 
106
    r = choose_sub_block_size(total_size, 0, &sub_block_size, &n_sub_blocks);
 
107
    assert(r == EINVAL);
 
108
    for (int i = 1; i < max_sub_blocks; i++) {
 
109
        r = choose_sub_block_size(total_size, i, &sub_block_size, &n_sub_blocks);
 
110
        assert(r == 0);
 
111
        assert(0 <= n_sub_blocks && n_sub_blocks <= i);
 
112
        assert(total_size <= n_sub_blocks * sub_block_size);
 
113
    }
 
114
}
 
115
 
 
116
int
 
117
test_main (int argc, const char *argv[]) {
 
118
    int i;
 
119
    for (i=1; i<argc; i++) {
 
120
        const char *arg = argv[i];
 
121
        if (strcmp(arg, "-v") == 0)
 
122
            verbose++;
 
123
    }
 
124
    test_sub_block_size(0);
 
125
    for (int total_size = 1; total_size <= 4*1024*1024; total_size *= 2) {
 
126
        test_sub_block_size(total_size);
 
127
    }
 
128
    return 0;
 
129
}