diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /storage/tokudb/PerconaFT/src/tests/test5092.cc | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/tokudb/PerconaFT/src/tests/test5092.cc')
-rw-r--r-- | storage/tokudb/PerconaFT/src/tests/test5092.cc | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/storage/tokudb/PerconaFT/src/tests/test5092.cc b/storage/tokudb/PerconaFT/src/tests/test5092.cc new file mode 100644 index 00000000..36fee5f6 --- /dev/null +++ b/storage/tokudb/PerconaFT/src/tests/test5092.cc @@ -0,0 +1,81 @@ +/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: +#ident "$Id$" +/*====== +This file is part of PerconaFT. + + +Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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 PerconaFT. If not, see <http://www.gnu.org/licenses/>. + +---------------------------------------- + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License, version 3, + as published by the Free Software Foundation. + + PerconaFT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. +======= */ + +#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." + +#include "test.h" +#include <sys/wait.h> + +static void clean_env (const char *envdir) { + const int len = strlen(envdir)+100; + char cmd[len]; + snprintf(cmd, len, "rm -rf %s", envdir); + int r = system(cmd); + CKERR(r); + CKERR(toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO)); +} + +static void setup_env (DB_ENV **envp, const char *envdir) { + { int chk_r = db_env_create(envp, 0); CKERR(chk_r); } + (*envp)->set_errfile(*envp, stderr); + { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } + { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } +} + +static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commit) { + DB *db; + DB_TXN *txn; + clean_env(envdir); + setup_env(envp, envdir); + CKERR(db_create(&db, *envp, 0)); + CKERR(db->open(db, NULL, "foo.db", 0, DB_BTREE, DB_CREATE | DB_AUTO_COMMIT, S_IRWXU+S_IRWXG+S_IRWXO)); + CKERR((*envp)->txn_begin(*envp, 0, &txn, 0)); + uint8_t gid[DB_GID_SIZE]; + memset(gid, 0, DB_GID_SIZE); + gid[0]=42; + CKERR(txn->prepare(txn, gid, 0)); + { int chk_r = db->close(db, 0); CKERR(chk_r); } + if (commit) + CKERR(txn->commit(txn, 0)); +} + +int test_main (int argc, char *const argv[]) { + default_parse_args(argc, argv); + DB_ENV *env; + setup_env_and_prepare(&env, TOKU_TEST_FILENAME, true); + { int chk_r = env ->close(env, 0); CKERR(chk_r); } + return 0; +} |