Skip to content
Open
5 changes: 3 additions & 2 deletions test/src/cpp-integration-filter-pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
using namespace tiledb;
using namespace tiledb::common;
using namespace tiledb::sm;
using namespace tiledb::test;

TEST_CASE(
"C++ API: Pipeline with filtered type conversions",
"[cppapi][filter][pipeline]") {
tiledb::Context ctx;
tiledb::Context& ctx = vanilla_context_cpp();
tiledb::VFS vfs(ctx);
std::string array_name = "cpp_test_array";
if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -142,7 +143,7 @@ TEST_CASE(
TEST_CASE(
"C++ API: Filter pipeline validation",
"[cppapi][filter][pipeline][validation]") {
tiledb::Context ctx;
tiledb::Context& ctx = vanilla_context_cpp();

tiledb::Domain domain(ctx);
float domain_lo = static_cast<float>(std::numeric_limits<int64_t>::min());
Expand Down
56 changes: 29 additions & 27 deletions test/src/cpp-integration-query-condition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@

#include <test/support/src/vfs_helpers.h>
#include <test/support/tdb_catch.h>
#include "test/support/src/helpers.h"
#include "tiledb/sm/cpp_api/tiledb"

using namespace tiledb;
using namespace tiledb::test;

int num_rows = 20;
int a_fill_value = -1;
Expand Down Expand Up @@ -328,8 +330,8 @@ TEST_CASE(
TestParams(TILEDB_DENSE, TILEDB_ROW_MAJOR, false, false));
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
test::VFSTestSetup vfs_test_setup;
Context ctx{vfs_test_setup.ctx()};
test::VFSTempDir vfs_test_setup;
Context ctx{vfs_test_setup->ctx()};
auto array_uri{vfs_test_setup.array_uri(array_name)};

// Create an empty query condition
Expand Down Expand Up @@ -361,8 +363,8 @@ TEST_CASE(
config.set("sm.query.sparse_unordered_with_dups.reader", "legacy");
}

auto vfs_test_setup2 = tiledb::test::VFSTestSetup(config.ptr().get(), false);
auto ctx2 = vfs_test_setup2.ctx();
auto vfs_test_setup2 = tiledb::test::VFSTempDir(config.ptr().get(), false);
auto ctx2 = vfs_test_setup2->ctx();
Array array(ctx2, array_uri, TILEDB_READ);
Query query(ctx2, array);

Expand All @@ -386,8 +388,8 @@ TEST_CASE(
"[query][query-condition][rest]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
test::VFSTestSetup vfs_test_setup;
Context ctx{vfs_test_setup.ctx()};
test::VFSTempDir vfs_test_setup;
Context ctx{vfs_test_setup->ctx()};
auto array_uri{vfs_test_setup.array_uri(array_name)};

// Define query condition (b < 4.0).
Expand Down Expand Up @@ -427,8 +429,8 @@ TEST_CASE(
config.set("sm.query.sparse_global_order.reader", "legacy");
config.set("sm.query.sparse_unordered_with_dups.reader", "legacy");
}
auto vfs_test_setup2 = tiledb::test::VFSTestSetup(config.ptr().get(), false);
auto ctx2 = vfs_test_setup2.ctx();
auto vfs_test_setup2 = tiledb::test::VFSTempDir(config.ptr().get(), false);
auto ctx2 = vfs_test_setup2->ctx();
Array array(ctx2, array_uri, TILEDB_READ);
Query query(ctx2, array);

Expand Down Expand Up @@ -513,8 +515,8 @@ TEST_CASE(
"[query][query-condition][negation][rest]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
test::VFSTestSetup vfs_test_setup;
Context ctx{vfs_test_setup.ctx()};
test::VFSTempDir vfs_test_setup;
Context ctx{vfs_test_setup->ctx()};
auto array_uri{vfs_test_setup.array_uri(array_name)};

// Define query condition (b < 4.0).
Expand Down Expand Up @@ -558,7 +560,7 @@ TEST_CASE(
}

vfs_test_setup.update_config(config.ptr().get());
Context ctx2 = vfs_test_setup.ctx();
Context ctx2 = vfs_test_setup->ctx();

Array array(ctx2, array_uri, TILEDB_READ);
Query query(ctx2, array);
Expand Down Expand Up @@ -644,7 +646,7 @@ TEST_CASE(
"[query][query-condition]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -775,7 +777,7 @@ TEST_CASE(
"[query][query-condition]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -916,7 +918,7 @@ TEST_CASE(
"[query][query-condition]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1043,7 +1045,7 @@ TEST_CASE(
"[query][query-condition]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1190,7 +1192,7 @@ TEST_CASE(
"[query][query-condition]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1355,7 +1357,7 @@ TEST_CASE(
"[query][query-condition][utf8]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1536,7 +1538,7 @@ TEST_CASE(
TEST_CASE(
"Testing dense query condition with overlapping fragment domains",
"[query][query-condition][dense][overlapping-fd]") {
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1612,7 +1614,7 @@ TEST_CASE(
TEST_CASE(
"Testing sparse query condition with the same fragment domain.",
"[query][query-condition][sparse][same-fd]") {
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1691,7 +1693,7 @@ TEST_CASE(
"[query][query-condition][dimension]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1836,7 +1838,7 @@ TEST_CASE(
"[query][query-condition][dimension]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -1996,7 +1998,7 @@ TEST_CASE(
"[query][query-condition][dimension]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -2141,7 +2143,7 @@ TEST_CASE(
"[query][query-condition][dimension]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -2305,7 +2307,7 @@ TEST_CASE(
"[query][query-condition][dimension]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -2487,7 +2489,7 @@ TEST_CASE(
TEST_CASE(
"Testing read query with simple QC, condition on dimensions, string dim",
"[query][query-condition][dimension]") {
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -2569,7 +2571,7 @@ TEST_CASE(
"[query][query-condition][attr-not-in-buffers]") {
// Initial setup.
std::srand(static_cast<uint32_t>(time(0)));
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down Expand Up @@ -2688,7 +2690,7 @@ TEST_CASE(
TEST_CASE(
"Testing read query with simple QC, condition on attribute, bool attr",
"[query][query-condition][dimension]") {
Context ctx;
Context& ctx = vanilla_context_cpp();
VFS vfs(ctx);

if (vfs.is_dir(array_name)) {
Expand Down
6 changes: 6 additions & 0 deletions test/src/test-capi-array-many-dimension-labels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class ExampleArray : public TemporaryDirectoryFixture {
ExampleArray()
: domain_{1, 4}
, t_domain_{1, 8} {
auto ctx = get_ctx();

// Create an array schema
uint64_t tile_extent{4};
auto array_schema = create_array_schema(
Expand Down Expand Up @@ -140,6 +142,8 @@ class ExampleArray : public TemporaryDirectoryFixture {
std::vector<double>& z1,
std::vector<double>& z2,
std::vector<int64_t>& time) {
auto ctx = get_ctx();

// Open array for writing.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -226,6 +230,8 @@ class ExampleArray : public TemporaryDirectoryFixture {
const std::vector<double>& expected_z1,
const std::vector<double>& expected_z2,
const std::vector<int64_t>& expected_time) {
auto ctx = get_ctx();

// Open array for reading.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down
6 changes: 3 additions & 3 deletions test/src/test-capi-consolidation-plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ConsolidationPlanFx {
bool is_array(const std::string& array_name);
void check_last_error(std::string expected);

VFSTestSetup vfs_test_setup_;
VFSTempDir vfs_test_setup_;

// TileDB context
tiledb_ctx_t* ctx_c_;
Expand All @@ -71,8 +71,8 @@ ConsolidationPlanFx::ConsolidationPlanFx() {
Config config;
config.set("sm.consolidation.buffer_size", "1000");
vfs_test_setup_.update_config(config.ptr().get());
ctx_c_ = vfs_test_setup_.ctx_c;
ctx_ = vfs_test_setup_.ctx();
ctx_c_ = vfs_test_setup_->ctx_c;
ctx_ = vfs_test_setup_->ctx();
array_name_ = vfs_test_setup_.array_uri("test_consolidation_plan_array");
}

Expand Down
4 changes: 4 additions & 0 deletions test/src/test-capi-dense-array-dimension-label-var.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ArrayExample : public TemporaryDirectoryFixture {
* @param label_order Label order for the dimension label.
*/
void create_example(tiledb_data_order_t label_order, void* index_domain) {
auto ctx = get_ctx();
// Create an array schema
uint64_t x_tile_extent{4};
auto array_schema = create_array_schema(
Expand Down Expand Up @@ -121,6 +122,7 @@ class ArrayExample : public TemporaryDirectoryFixture {
std::vector<double> input_attr_data,
std::string input_label_data,
std::vector<uint64_t> input_label_offsets) {
auto ctx = get_ctx();
// Open array for writing.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -179,6 +181,7 @@ class ArrayExample : public TemporaryDirectoryFixture {
const std::vector<double> expected_attr_data,
const std::string expected_label_data,
const std::vector<uint64_t> expected_label_offsets) {
auto ctx = get_ctx();
// Open array for reading.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -251,6 +254,7 @@ class ArrayExample : public TemporaryDirectoryFixture {
const std::vector<double> expected_attr_data,
const std::string expected_label_data,
const std::vector<uint64_t> expected_label_offsets) {
auto ctx = get_ctx();
// Open array for reading.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down
6 changes: 6 additions & 0 deletions test/src/test-capi-dense-array-dimension-label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture {
* @param label_order Label order for the dimension label.
*/
void create_example(tiledb_data_order_t label_order) {
auto ctx = get_ctx();
// Create an array schema
uint64_t x_tile_extent{4};
auto array_schema = create_array_schema(
Expand Down Expand Up @@ -130,6 +131,7 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture {
std::vector<double> input_attr_data,
std::vector<double> input_label_data,
bool error_on_write = false) {
auto ctx = get_ctx();
// Open array for writing.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -196,6 +198,7 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture {
std::vector<double> input_attr_data,
std::vector<double> input_label_data,
bool error_on_write = false) {
auto ctx = get_ctx();
// Open array for writing.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -256,6 +259,7 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture {
void check_values_from_data_reader(
const std::vector<double>& expected_label_data,
const std::vector<double>& expected_attr_data) {
auto ctx = get_ctx();
// Open array for reading.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down Expand Up @@ -324,6 +328,8 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture {
const std::vector<double> ranges,
const std::vector<double> expected_label_data,
const std::vector<double> expected_attr_data) {
auto ctx = get_ctx();

// Open array for reading.
tiledb_array_t* array;
require_tiledb_ok(tiledb_array_alloc(ctx, array_name.c_str(), &array));
Expand Down
4 changes: 4 additions & 0 deletions test/src/test-capi-dimension-label-encrypted.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ TEST_CASE_METHOD(
TemporaryDirectoryFixture,
"C-API: create encrypted array with a dimension label",
"[capi][ArraySchema][DimensionLabel][encryption]") {
auto ctx = get_ctx();

// Create an array schema and add a dimension label.
uint64_t x_domain[2]{0, 63};
uint64_t x_tile_extent{64};
Expand Down Expand Up @@ -129,6 +131,8 @@ TEST_CASE_METHOD(
TemporaryDirectoryFixture,
"C-API: write encrypted dense array with a dimension label",
"[capi][ArraySchema][DimensionLabel][encryption]") {
auto ctx = get_ctx();

// Create an array schema and add a dimension label.
uint64_t x_domain[2]{0, 3};
uint64_t x_tile_extent{4};
Expand Down
Loading
Loading