From 5a8338a2537d1aca007fee7d5c1927b3a83c2da3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 8 Nov 2015 05:37:59 +0100 Subject: Merging upstream version 1.3~pre2. Signed-off-by: Daniel Baumann --- ztest.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ztest.cc') diff --git a/ztest.cc b/ztest.cc index 86a8518..cb78eb1 100644 --- a/ztest.cc +++ b/ztest.cc @@ -152,13 +152,24 @@ int ztest_file( const int infd, int format_index, const std::string & input_filename, const std::vector< const char * > & ztest_args ) { + static int disable_xz = -1; // tri-state bool const uint8_t * magic_data = 0; int magic_size = 0; if( format_index < 0 ) format_index = test_format( infd, &magic_data, &magic_size ); const char * const compressor_name = get_compressor_name( format_index ); if( !compressor_name ) - return 0; // skip this file + return 0; // ignore this file + if( format_index == fmt_xz ) + { + if( disable_xz < 0 ) + { + std::string command( compressor_name ); command += " -V > /dev/null"; + disable_xz = ( std::system( command.c_str() ) != 0 ); + } + if( disable_xz ) return 0; // ignore this file if no xz installed + } + const pid_t pid = fork(); if( pid == 0 ) // child (compressor) -- cgit v1.2.3