Skip to content

Commit 0668153

Browse files
committed
change the code to test accurate
Signed-off-by: muthuja <muthujabavaji.vempalli@progress.com>
1 parent cdb9068 commit 0668153

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/omnibus/fetchers/net_fetcher.rb

+11-8
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ def downloaded_file
135135
# Execute the tests only for libxml2 tarball
136136
if filename.include?("libxml2")
137137
execute_tests(file_path)
138-
end
139138
# List files under the directory of the downloaded file with permissions
140-
directory_listing = `ls -l #{File.dirname(file_path)}`.strip
141-
log.info(log_key) { "-----DEBUG-----Contents of the directory of the downloaded file:\n#{directory_listing}" }
142-
end
139+
directory_listing = `ls -l #{File.dirname(file_path)}`.strip
140+
log.info(log_key) { "-----DEBUG-----Contents of the directory of the downloaded file:\n#{directory_listing}" }
141+
end
142+
end
143143

144144
file_path
145145
end
@@ -148,6 +148,7 @@ def execute_tests(file_path)
148148
# Create a directory under /tmp
149149
test_dir = "/tmp/testlib"
150150
FileUtils.mkdir_p(test_dir)
151+
log.info(log_key) { "-----DEBUG-----Test directory created: #{Dir.exist?(test_dir)}" }
151152

152153
# Copy the libxml archive to /tmp/testlib
153154
FileUtils.cp(file_path, test_dir)
@@ -158,11 +159,13 @@ def execute_tests(file_path)
158159

159160
# Extract the archive
160161
archive_path = File.join(test_dir, File.basename(file_path))
161-
system("gtar Jxf #{archive_path} -C #{extract_dir}")
162+
log.info(log_key) { "-----DEBUG-----Extracting archive: #{archive_path} to #{extract_dir}" }
163+
returns = [0] # List of acceptable exit codes
164+
shellout!("gtar -Jxf #{archive_path} -C #{extract_dir}", returns: returns)
162165

163-
log.info(log_key) { "-----DEBUG-----Test directory created at #{test_dir}" }
164-
log.info(log_key) { "-----DEBUG-----Extract directory created at #{extract_dir}" }
165-
log.info(log_key) { "-----DEBUG-----Archive extracted to #{extract_dir}" }
166+
# List all files and directories under /tmp
167+
tmp_listing = `ls -l /tmp`.strip
168+
log.info(log_key) { "-----DEBUG-----Contents of /tmp:\n#{tmp_listing}" }
166169
end
167170

168171
#

0 commit comments

Comments
 (0)