Commits
20 20 | //# MA 02111-1307 USA |
21 21 | //# $Id: $ |
22 22 | |
23 23 | |
24 24 | |
25 25 | using namespace casacore; |
26 26 | namespace casa { //# NAMESPACE CASA - BEGIN |
27 27 | |
28 28 | namespace vi { //# NAMESPACE VI - BEGIN |
29 29 | |
30 + | int removeFile(const char *fpath, const struct stat *sb, int typeflag, |
31 + | struct FTW* ftwbuf); |
32 + | |
33 + | int removeFile(const char *fpath, const struct stat *sb, int typeflag, |
34 + | struct FTW* ftwbuf) |
35 + | { |
36 + | (void)sb; //Unused vars |
37 + | (void)typeflag; |
38 + | (void)ftwbuf; |
39 + | |
40 + | int rv = remove(fpath); |
41 + | if(rv) |
42 + | perror(fpath); |
43 + | return rv; |
44 + | } |
45 + | |
46 + | |
30 47 | ////////////////////////////////////////////////////////////////////////// |
31 48 | // FreqAxisTVITest class |
32 49 | ////////////////////////////////////////////////////////////////////////// |
33 50 | |
34 51 | // ----------------------------------------------------------------------- |
35 52 | // |
36 53 | // ----------------------------------------------------------------------- |
37 54 | FreqAxisTVITest::FreqAxisTVITest(): |
38 55 | autoMode_p(true), testResult_p(true) |
39 56 | { |
82 99 | generateReferenceFile(); |
83 100 | |
84 101 | return; |
85 102 | } |
86 103 | |
87 104 | // ----------------------------------------------------------------------- |
88 105 | // |
89 106 | // ----------------------------------------------------------------------- |
90 107 | void FreqAxisTVITest::TearDown() |
91 108 | { |
92 - | String rm_command; |
93 - | |
94 - | rm_command = String ("rm -rf ") + testFile_p; |
95 - | system(rm_command.c_str()); |
96 - | |
97 - | rm_command = String ("rm -rf ") + referenceFile_p; |
98 - | system(rm_command.c_str()); |
109 + | //Recursively remove the test and reference files |
110 + | nftw(testFile_p.c_str(), removeFile, 64, FTW_DEPTH | FTW_PHYS); |
111 + | nftw(referenceFile_p.c_str(), removeFile, 64, FTW_DEPTH | FTW_PHYS); |
99 112 | |
100 113 | if (autoMode_p) |
101 - | { |
102 - | rm_command = String ("rm -rf ") + inpFile_p; |
103 - | system(rm_command.c_str()); |
104 - | } |
114 + | nftw(inpFile_p.c_str(), removeFile, 64, FTW_DEPTH | FTW_PHYS); |
105 115 | |
106 116 | return; |
107 117 | } |
108 118 | |
109 119 | |
110 120 | ////////////////////////////////////////////////////////////////////////// |
111 121 | // Convenience methods |
112 122 | ////////////////////////////////////////////////////////////////////////// |
113 123 | |
114 124 | // ----------------------------------------------------------------------- |