Skip to content

Commit

Permalink
Improved verbosity; prefetch's output goes to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
klymenko committed Apr 29, 2024
1 parent 6065aef commit 5f54128
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 90 deletions.
37 changes: 17 additions & 20 deletions test/external/prefetch/out_dir_and_file.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#
# Please cite the author in any work or product based on this material.
#
# ==============================================================================
# =============================================================================$

use Cwd qw(abs_path);

($DIRTOTEST, $BINDIR, $PREFETCH) = @ARGV;
($DIRTOTEST, $BINDIR, $PREFETCH, $VERBOSE) = @ARGV;
$DIRTOTEST = abs_path($DIRTOTEST);
$BINDIR = abs_path($BINDIR );

Expand All @@ -38,9 +38,6 @@
`echo 'repository/remote/main/SDL.2/resolver-cgi = "$SDL"' > tmp/t.kfg`;
die if $?;

`echo '/LIBS/GUID = "8test002-6ab7-41b2-bfd0-prefetchpref"' >> tmp/t.kfg`;
die if $?;

$CWD = `pwd`; die if $?; chomp $CWD;

$PUBLIC = '/repository/user/main/public';
Expand All @@ -55,15 +52,15 @@
$CMD = "NCBI_SETTINGS=/ NCBI_VDB_RELIABLE=y VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH $SRAC -o tmp-file";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die 'Is there DIRTOTEST?' if $?;
`$CMD`; die 'Is there DIRTOTEST?' if $?;
`rm tmp-file`; die if $?;

print "PREFETCH ACCESSION TO OUT-FILE INSIDE OF DIR\n";
`rm -f tmp3/dir/file`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH $SRAC -O / -o tmp3/dir/file";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/file` ; die if $?;

`echo '/libs/cloud/report_instance_identity = "false"' > tmp.mkfg`;
Expand All @@ -78,23 +75,23 @@
$CMD = "NCBI_SETTINGS=/ NCBI_VDB_RELIABLE=y VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH $SRR -O / -o tmp3/dir/file";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/file` ; die if $?;

print "PREFETCH HTTP DIRECTORY URL TO OUT-FILE\n";
`rm -f tmp3/dir/file`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/ -O / -o tmp3/dir/file";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/file` ; die if $?;

print "PREFETCH HTTP FILE URL TO OUT-FILE\n";
`rm -f tmp3/dir/file`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/ngs/wiki -O / -o tmp3/dir/file";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/file` ; die if $?;

print "downloading multiple items to file\n";
Expand All @@ -108,14 +105,14 @@
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH SRR045450 $SRAC";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null` ; die if $?;
`$CMD`; die if $?;
`rm tmp/sra/SRR045450.sra tmp/sra/$SRAC.sra`; die if $?;

print "PREFETCH SRR HTTP URL\n";
`rm -fr tmp/sra/$SRAC.sra`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp $DIRTOTEST/$PREFETCH $SRR";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null` ; die if $?;
`$CMD`; die if $?;
`rm tmp/sra/$SRAC.sra`; die if $?;

print "PREFETCH HTTP DIRECTORY URL\n";
Expand All @@ -124,7 +121,7 @@
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm index.html` ; die if $?;
chdir $CWD or die;

Expand All @@ -134,40 +131,40 @@
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/ngs/wiki";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`rm wiki` ; die if $?;
chdir $CWD or die;
`$CMD` ; die if $?;
`rm wiki` ; die if $?;
chdir $CWD or die;

print "PREFETCH ACCESSION TO OUT-DIR\n";
`rm -f tmp3/dir/$SRAC/$SRAC.sra`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH $SRAC -O tmp3/dir";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null` ; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/$SRAC/$SRAC.sra`; die if $?;

print "PREFETCH SRR HTTP URL TO OUT-DIR\n";
`rm -f tmp3/dir/$SRAC/$SRAC.sra`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH $SRR -O tmp3/dir";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null` ; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/$SRAC/$SRAC.sra`; die if $?;

print "PREFETCH HTTP DIRECTORY URL TO OUT-DIR\n";
`rm -f index.html tmp3/dir/index.html`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/ -O tmp3/dir";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null` ; die if $?;
`$CMD` ; die if $?;
`rm tmp3/dir/index.html`; die if $?;

print "PREFETCH HTTP FILE URL TO OUT-DIR\n";
`rm -f wiki tmp3/dir/wiki`; die if $?;
$CMD = "NCBI_SETTINGS=/ VDB_CONFIG=$CWD/tmp " .
"$DIRTOTEST/$PREFETCH https://github.com/ncbi/ngs/wiki -O tmp3/dir";
print "$CMD\n" if $VERBOSE;
`$CMD 2> /dev/null`; die if $?;
`$CMD`; die if $?;
`rm tmp3/dir/wiki` ; die if $?;

`rm -r tmp*`; die if $?;
Loading

0 comments on commit 5f54128

Please sign in to comment.