@@ -266,13 +266,47 @@ build_default() {
266266 setup_helper
267267 run run_configure
268268 assert_success
269- # run make all
270- # if [ "$distro_id" = "ID=fedora" ]; then
271- # # Because compiling fails
272- # assert_failure
273- # else
274- # assert_success
275- # fi
269+ after_files=$( find . -type f)
270+ filtered_files=()
271+ for af in $after_files ; do
272+ if [[ ! " ${before_files[*]} " =~ " ${af} " ]]; then
273+ filtered_files+=($af )
274+ echo " # Lost $af " >&3
275+ fi
276+ done
277+ run make distclean
278+ assert_success
279+ after_clean_files=$( find . -type f)
280+ # Files which were there to begin with should
281+ # still be there.
282+ for bf in $before_files ; do
283+ if [[ ! " ${after_clean_files[*]} " =~ " ${bf} " ]]; then
284+ run echo " Wrongly removed: $bf , existed in original tarball but was removed after 'distclean'"
285+ refute_line " Wrongly removed: $bf , existed in original tarball but was removed after 'distclean'"
286+ fi
287+ done
288+ # Files which we now find should have been there in the beginning.
289+ for af in $after_clean_files ; do
290+ if [[ ! " ${before_files[*]} " =~ " ${af} " ]]; then
291+ run echo " Wrongly kept: $af , didn't exist in original tarball but was kept after 'distclean'"
292+ refute_line " Wrongly kept: $af , didn't exist in original tarball but was kept after 'distclean'"
293+ fi
294+ done
295+ }
296+
297+
298+ @test " make clean removes all generated files" {
299+ docs_required_install & > /dev/zero
300+ setup_helper
301+ run run_configure
302+ assert_success
303+ run make all
304+ if [ " $distro_id " = " ID=fedora" ]; then
305+ # Because compiling fails
306+ assert_failure
307+ else
308+ assert_success
309+ fi
276310 after_files=$( find . -type f)
277311 # Find the new files not in the tarball
278312 # echo "# Working with: $after_files" >&3
@@ -283,9 +317,7 @@ build_default() {
283317 echo " # Lost $af " >&3
284318 fi
285319 done
286- # run make clean
287- # assert_success
288- run make distclean
320+ run make clean
289321 assert_success
290322 after_clean_files=$( find . -type f)
291323 # Files which were there to begin with should
0 commit comments