Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6ca8df2

Browse files
committed
Skip the 004_io_direct.pl test if a pre-flight check fails.
The test previously had a list of OSes that direct I/O was expected towork on. That worked well enough for the systems in our build farm, butdidn't survive contact with the Debian build bots running on tmpfs viaoverlayfs. tmpfs does not support O_DIRECT, but we don't want toexclude Linux generally.The new approach is to try to create an empty file with O_DIRECT fromPerl first. If that fails, we'll skip the test and report what theerror was.Reported-by: Christoph Berg <myon@debian.org>Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>Reviewed-by: Andrew Dunstan <andrew@dunslane.net>Discussion:https://postgr.es/m/ZDYd4A78cT2ULxZZ%40msg.df7cb.de
1 parentb37d051 commit6ca8df2

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

‎src/test/modules/test_misc/t/004_io_direct.pl

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,38 @@
22

33
use strict;
44
use warnings;
5+
use Fcntl;
6+
use IO::File;
57
use PostgreSQL::Test::Cluster;
68
use PostgreSQL::Test::Utils;
79
use Test::More;
810

9-
# Systems that we know to have direct I/O support, and whose typical local
10-
# filesystems support it or at least won't fail with an error. (illumos should
11-
# probably be in this list, but perl reports it as solaris. Solaris should not
12-
# be in the list because we don't support its way of turning on direct I/O, and
13-
# even if we did, its version of ZFS rejects it, and OpenBSD just doesn't have
14-
# it.)
15-
if (!grep { $^Oeq$_ }qw(aix darwin dragonfly freebsd linux MSWin32 netbsd))
11+
# We know that macOS has F_NOCACHE, and we know that Windows has
12+
# FILE_FLAG_NO_BUFFERING, and we assume that their typical file systems will
13+
# accept those flags. For every other system, we'll probe for O_DIRECT
14+
# support.
15+
16+
if ($^One'darwin' && $^One'MSWin32')
1617
{
17-
planskip_all=>"no direct I/O support";
18+
# Perl's Fcntl module knows if this system has O_DIRECT in <fcntl.h>.
19+
if (defined &O_DIRECT)
20+
{
21+
# Can we open a file in O_DIRECT mode in the file system where
22+
# tmp_check lives?
23+
my$f = IO::File->new(
24+
"${PostgreSQL::Test::Utils::tmp_check}/test_o_direct_file",
25+
O_RDWR | O_DIRECT | O_CREAT);
26+
if (!$f)
27+
{
28+
planskip_all=>
29+
"pre-flight test if we can open a file with O_DIRECT failed:$!";
30+
}
31+
$f->close;
32+
}
33+
else
34+
{
35+
planskip_all=>"no O_DIRECT";
36+
}
1837
}
1938

2039
my$node = PostgreSQL::Test::Cluster->new('main');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp