Changeset 1458


Ignore:
Timestamp:
Aug 30, 2008, 9:41:00 PM (15 years ago)
Author:
Peter
Message:

moving LFS test to separate file so skipping the test (when using --disable-largefile) becomes more visible.

Location:
trunk/test
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r1447 r1458  
    3232check_LTLIBRARIES = libyattest.la
    3333
    34 check_PROGRAMS = alignment_test averager_test                   \
     34check_PROGRAMS = alignment_test averager_test \
    3535  commandline_test \
    3636  consensus_inputranker_test data_lookup_1d_test  \
     
    3939  index_test inputranker_test \
    4040  iterator_test kernel_lookup_test kernel_test \
    41   knn_test matrix_lookup_test matrix_test \
     41  knn_test large_file_test matrix_lookup_test matrix_test \
    4242  nbc_test \
    4343  ncc_test nni_test normalization_test pca_test \
     
    7979kernel_lookup_test_SOURCES = kernel_lookup_test.cc
    8080knn_test_SOURCES = knn_test.cc 
     81large_file_test_SOURCES = large_file_test.cc
    8182matrix_test_SOURCES = matrix_test.cc
    8283matrix_lookup_test_SOURCES = matrix_lookup_test.cc
  • trunk/test/fileutil_test.cc

    r1457 r1458  
    2323  02111-1307, USA.
    2424*/
    25 
    26 #ifdef HAVE_CONFIG_H
    27 #include "config.h"
    28 #endif
    2925
    3026#include "Suite.h"
     
    182178  }
    183179
    184   #ifndef YAT_LFS_DISABLED
    185   test_large_file_support(suite);
    186   #else
    187   suite.err() << "Skipping test of large file support\n";
    188   #endif
    189180  return suite.return_value();
    190181}
    191182
    192 void test_large_file_support(test::Suite& suite)
    193 {
    194   bool ok=true;
    195   suite.err() << "Testing Large File Support\n";
    196   off_t s = std::numeric_limits<off_t>::max() >> 20;
    197   suite.err() << "maximal file size: " << s << " Mb" << std::endl;
    198   suite.add(s>2048);
    199   if (ok)
    200     suite.err() << "Ok\n";
    201   else
    202     suite.err() << "failed\n";
    203 }
  • trunk/test/large_file_test.cc

    r1457 r1458  
    22
    33/*
    4   Copyright (C) 2006 Jari Häkkinen
    5   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    64  Copyright (C) 2008 Peter Johansson
    75
     
    3028#include "Suite.h"
    3129
    32 #include "yat/utility/FileUtil.h"
    33 #include "yat/utility/Exception.h"
    34 
    35 #include <fstream>
    36 #include <iostream>
    3730#include <string>
     31#include <sys/stat.h>
    3832
    3933using namespace theplu::yat;
     
    4337
    4438  test::Suite suite(argc, argv);
    45   suite.err() << "testing FileUtil ... " << std::endl;
    46 
    47   // checking permissions for current directory
    48   try {
    49     suite.err() << "FileUtil Test 1" << std::endl;
    50     bool testval=true;
    51     utility::FileUtil file(".");
    52     if (testval=file.exists())
    53       suite.err() << "\tfile exists: " << file.path() << std::endl;
    54     suite.add(testval);
    55     if (!(testval=file.permissions("rwx")))
    56       suite.err() << "\trwx permissions on " << file.path() << std::endl;
    57     suite.add(!testval);
    58     if (!(testval=file.permissions("rx")))
    59       suite.err() << "\trx permissions on " << file.path() << std::endl;
    60     suite.add(!testval);
    61     if (!(testval=file.permissions("d")))
    62       suite.err() << "\td permissions on " << file.path() << std::endl;
    63     suite.add(!testval);
    64   }
    65   catch (utility::IO_error e) {
    66     suite.add(false);
    67     suite.err() << e.what() << std::endl;
    68   }
    69 
    70   // checking permissions on non-existent file with ./ in path
    71   try {
    72     suite.err() << "FileUtil Test 2" << std::endl;
    73     bool testval=true;
    74     // filename below should be unique
    75     utility::FileUtil file("./fileio_test.sdf34DSF");
    76     suite.err() << "\tpath: " << std::endl;
    77     if (!(testval=file.exists()))
    78       suite.err() << "\tfile does not exist: " << file.path() << std::endl;
    79     suite.add(!testval);
    80     if (!(testval=file.permissions("r")))
    81       suite.err() << "\tr permission on " << file.path() << std::endl;
    82     suite.add(!testval);
    83     if (!(testval=file.permissions("rwx")))
    84       suite.err() << "\trwx permissions on " << file.path() << std::endl;
    85     suite.add(!testval);
    86     if (!(testval=file.permissions("w")))
    87       suite.err() << "\tw permission on " << file.path() << std::endl;
    88     suite.add(!testval); // 'w' on non-existent file ok if directory writeable
    89     if (!(testval=file.permissions("d")))
    90       suite.err() << "\td permission on " << file.path() << std::endl;
    91     suite.add(!testval);
    92   }
    93   catch (utility::IO_error e) {
    94     suite.add(false);
    95     suite.err() << e.what() << std::endl;
    96   }
    97 
    98   // checking permissions on non-existent file without ./ in path
    99   try {
    100     suite.err() << "FileUtil Test 3" << std::endl;
    101     bool testval=true;
    102     // filename below should be unique
    103     utility::FileUtil file("fileio_test.sdf34DSF");
    104     if (!(testval=file.exists()))
    105       suite.err() << "\tfile does not exist: " << file.path() << std::endl;
    106     suite.add(!testval);
    107     if (!(testval=file.permissions("r")))
    108       suite.err() << "\tr permission on " << file.path() << std::endl;
    109     suite.add(!testval);
    110     if (!(testval=file.permissions("rwx")))
    111       suite.err() << "\trwx permissions on " << file.path() << std::endl;
    112     suite.add(!testval);
    113     if (!(testval=file.permissions("w")))
    114       suite.err() << "\tw permission on " << file.path() << std::endl;
    115     suite.add(!testval); // 'w' on non-existent file ok if directory writeable
    116     if (!(testval=file.permissions("d")))
    117       suite.err() << "\td permission on " << file.path() << std::endl;
    118     suite.add(!testval);
    119   }
    120   catch (utility::IO_error e) {
    121     suite.add(false);
    122     suite.err() << e.what() << std::endl;
    123   }
    124 
    125   // checking permissions on non-existent file with non-existent
    126   // directories in path
    127   try {
    128     suite.err() << "FileUtil Test 4" << std::endl;
    129     bool testval=true;
    130      // intermediate dir must be unique!
    131     utility::FileUtil file("./fileio_test.sdf34DSF/file");
    132     if (!(testval=file.exists()))
    133       suite.err() << "\tfile does not exist: " << file.path() << std::endl;
    134     suite.add(!testval);
    135     if ((testval=file.permissions("r")))
    136       suite.err() << "\tr permission failed on " << file.path() << std::endl;
    137     suite.add(testval);
    138     if (testval=file.permissions("rwx"))
    139       suite.err() << "\trwx permissions failed on " << file.path() << std::endl;
    140     suite.add(testval);
    141     if (testval=file.permissions("w"))
    142       suite.err() << "\tw permission failed on " << file.path() << std::endl;
    143     suite.add(testval);
    144     if (testval=file.permissions("d"))
    145       suite.err() << "\td permission failed on " << file.path() << std::endl;
    146     suite.add(testval);
    147   }
    148   catch (utility::IO_error e) {
    149     suite.add(false);
    150     suite.err() << e.what() << std::endl;
    151   }
    152 
    153   // checking permissions on existent file after non-existence file
    154   // has been checked
    155   try {
    156     suite.err() << "FileUtil Test 5" << std::endl;
    157     bool testval=true;
    158      // intermediate dir must be unique!
    159     utility::FileUtil file("./fileio_test.sdf34DSF/file");
    160     if (!(testval=file.exists()))
    161       suite.err() << "\tfile does not exist: " << file.path() << std::endl;
    162     suite.add(!testval);
    163     utility::FileUtil file2(test::filename("fileutil_test.cc").c_str());
    164     if (!(testval=!file2.exists()))
    165       suite.err() << "\tfile does exist: " << file2.path() << std::endl;
    166     suite.add(!testval);
    167   }
    168   catch (utility::IO_error e) {
    169     suite.add(false);
    170     suite.err() << e.what() << std::endl;
    171   }
    172 
    173   try {
    174     suite.err() << "FileUtil Test 6" << std::endl;
    175     utility::FileUtil file("fileutil_test.cc");
    176     file.permissions("rxwa"); // should throw
    177     suite.add(false);
    178   }
    179   catch (std::invalid_argument& e) {
    180     suite.err() << "Expected exception thrown with what: " << e.what()
    181                 << std::endl;
    182   }
    18339
    18440  #ifndef YAT_LFS_DISABLED
     
    18642  #else
    18743  suite.err() << "Skipping test of large file support\n";
     44  exit(77);
    18845  #endif
    18946  return suite.return_value();
Note: See TracChangeset for help on using the changeset viewer.