Use -f in Perl instead of ls for checking if a file exists

pull/220/head
Andreas Karlsson 4 months ago committed by Andreas Karlsson
parent be5697148e
commit 3f89df53c8
  1. 7
      contrib/pg_tde/t/001_basic.pl
  2. 10
      contrib/pg_tde/t/007_tde_heap.pl
  3. 1
      contrib/pg_tde/t/expected/001_basic.out

@ -50,11 +50,10 @@ PGTDE::psql($node, 'postgres', 'SELECT * FROM test_enc ORDER BY id ASC;');
my $tablefile = $node->data_dir . '/'
. $node->safe_psql('postgres', "SELECT pg_relation_filepath('test_enc');");
my $strings = 'TABLEFILE FOUND: ';
$strings .= `(ls $tablefile >/dev/null && echo yes) || echo no`;
PGTDE::append_to_result_file($strings);
PGTDE::append_to_result_file(
'TABLEFILE FOUND: ' . (-f $tablefile ? 'yes' : 'no'));
$strings = 'CONTAINS FOO (should be empty): ';
my $strings = 'CONTAINS FOO (should be empty): ';
$strings .= `strings $tablefile | grep foo`;
PGTDE::append_to_result_file($strings);

@ -108,15 +108,17 @@ sub verify_table
PGTDE::psql($node, 'postgres',
'SELECT * FROM ' . $table . ' ORDER BY id ASC;');
my $strings = 'TABLEFILE FOR ' . $table . ' FOUND: ';
$strings .= `(ls $tablefile >/dev/null && echo -n yes) || echo -n no`;
PGTDE::append_to_result_file($strings);
PGTDE::append_to_result_file('TABLEFILE FOR '
. $table
. ' FOUND: '
. (-f $tablefile ? 'yes' : 'no'));
$strings = 'CONTAINS FOO (should be empty): ';
my $strings = 'CONTAINS FOO (should be empty): ';
$strings .= `strings $tablefile | grep foo`;
PGTDE::append_to_result_file($strings);
}
# Verify that we can't see the data in the files
verify_table('test_enc1');
verify_table('test_enc2');
verify_table('test_enc3');

@ -38,7 +38,6 @@ SELECT * FROM test_enc ORDER BY id ASC;
(2 rows)
TABLEFILE FOUND: yes
CONTAINS FOO (should be empty):
DROP TABLE test_enc;
DROP EXTENSION pg_tde;

Loading…
Cancel
Save