Skip to content

Commit 93a2621

Browse files
Streamline skipping tests if DenyWriteAccess is not supported. (#5683)
This happens on Windows, and when running as root (which the manylinux CI job does). --- TYPE: NO_HISTORY
1 parent 011798f commit 93a2621

File tree

5 files changed

+30
-14
lines changed

5 files changed

+30
-14
lines changed

.github/workflows/ci-linux_mac.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ env:
7777
CMAKE_GENERATOR: ${{ inputs.cmake_generator }}
7878
TILEDB_CI_BACKEND: ${{ inputs.ci_backend }}
7979
TILEDB_CI_OS: ${{ startsWith(inputs.matrix_image, 'ubuntu-') && 'Linux' || 'macOS' }}
80-
TILEDB_MANYLINUX: ${{ !inputs.manylinux && 'ON' || 'OFF' }}
8180
CXX: ${{ inputs.matrix_compiler_cxx }}
8281
CC: ${{ inputs.matrix_compiler_cc }}
8382
CFLAGS: ${{ inputs.matrix_compiler_cflags }}
@@ -143,7 +142,7 @@ jobs:
143142
if: inputs.manylinux
144143
run: |
145144
set -e pipefail
146-
yum install -y redhat-lsb-core perl-IPC-Cmd perl-Time-Piece curl zip unzip tar
145+
dnf install -y redhat-lsb-core perl-IPC-Cmd perl-Time-Piece curl zip unzip tar
147146
148147
# This must happen after checkout, because checkout would remove the directory.
149148
- name: Install Ninja

test/src/unit-capi-consolidation.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7537,10 +7537,6 @@ TEST_CASE_METHOD(
75377537
if (!vfs_test_setup_.is_local()) {
75387538
return;
75397539
}
7540-
char* manylinux_var = getenv("TILEDB_MANYLINUX");
7541-
if (manylinux_var && strlen(manylinux_var) > 0) {
7542-
return;
7543-
}
75447540

75457541
bool dense_test = true;
75467542
std::string array_uri;
@@ -7641,10 +7637,6 @@ TEST_CASE_METHOD(
76417637
if (!vfs_test_setup_.is_local()) {
76427638
return;
76437639
}
7644-
char* manylinux_var = getenv("TILEDB_MANYLINUX");
7645-
if (manylinux_var && strlen(manylinux_var) > 0) {
7646-
return;
7647-
}
76487640

76497641
bool dense_test = true;
76507642
std::string array_uri;

test/src/unit-capi-query.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,10 +733,6 @@ TEST_CASE_METHOD(
733733
// DenyWriteAccess is not supported on Windows.
734734
if constexpr (tiledb::platform::is_os_windows)
735735
return;
736-
// The test fails on Manylinux. Skip it.
737-
char* manylinux_var = getenv("TILEDB_MANYLINUX");
738-
if (manylinux_var && strlen(manylinux_var) > 0)
739-
return;
740736
SupportedFsLocal local_fs;
741737
std::string temp_dir = local_fs.temp_dir();
742738
std::string array_name = temp_dir + "write_failure";

test/support/src/vfs_helpers.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
#include "tiledb/sm/filesystem/s3.h"
5050
#endif
5151

52+
#ifndef _WIN32
53+
#include <unistd.h>
54+
#endif
55+
5256
#include "tiledb/sm/rest/rest_client.h"
5357

5458
namespace tiledb::test {
@@ -422,6 +426,16 @@ std::string TemporaryDirectoryFixture::create_temporary_array(
422426
return array_uri;
423427
}
424428

429+
DenyWriteAccess::SkipOnUnsupported::SkipOnUnsupported() {
430+
#ifdef _WIN32
431+
SKIP("DenyWriteAccess is not supported on Windows");
432+
#else
433+
if (geteuid() == 0) {
434+
SKIP("DenyWriteAccess is not supported when running as root");
435+
}
436+
#endif
437+
}
438+
425439
VFSTestBase::VFSTestBase(
426440
const std::vector<size_t>& test_tree, const std::string& prefix)
427441
: test_tree_(test_tree)

test/support/src/vfs_helpers.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,21 @@ class DenyWriteAccess {
949949
}
950950

951951
private:
952+
/**
953+
* Helper class that skips the test when constructed, if DenyWriteAccess is
954+
* not supported.
955+
*/
956+
class SkipOnUnsupported {
957+
public:
958+
SkipOnUnsupported();
959+
};
960+
961+
/**
962+
* Dummy object to have its constructor called, before anything else when
963+
* constructing DenyWriteAccess.
964+
*/
965+
const SkipOnUnsupported skip_on_unsupported_;
966+
952967
/** The path. */
953968
const std::string path_;
954969

0 commit comments

Comments
 (0)