Tomasz Miąsko [Wed, 2 May 2018 00:00:00 +0000 (00:00 +0000)]
Avoid TOCTOU issue when deciding if config is valid
Previously, a separate call to access had been used to distinguish
between I/O errors and invalid configuration file. This could lead to
spurious errors if configuration file have been created in-between call
to conf_read and access. Use errno to tell those two cases apart.
This is not the actual Travis docker container, but it
should be similar enough for doing local verification:
make travis
make travis CC=clang
make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0"
make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe"
Previously if compiler command was an .sh script, win32 version
automatically added an .EXE extension to the command line and
then test case failed. With this change .sh files won't get
appended by an EXE extension and test case successfully runs
Joel Rosdahl [Mon, 12 Mar 2018 21:25:28 +0000 (22:25 +0100)]
cleanup: Improve robustness when multiple cleanups run concurrently
The file count/size counters are now intentionally subtracted even if
there file to delete has disappeared since the final cache size
calculation will be incorrect if they aren’t. This can happen when there
are several parallel ongoing cleanups of the same subdirectory.
Also removed the “delete sibling files” logic; it’s unnecessary for all
siblings except .stderr since that’s the only file in a result that is
optional. Any other missing file will be detected by
get_file_from_cache.
Joel Rosdahl [Sun, 4 Mar 2018 09:45:50 +0000 (10:45 +0100)]
Improve man page generation
* Use AsciiDoc’s a2x tool instead of running xsltproc explicitly.
* Stow away ccache.1 in doc.
* Make AsciiDoc literals stand out as bold in the man page. We can now
use properly literals instead of emphasis in the manual.
Joel Rosdahl [Tue, 6 Feb 2018 20:49:55 +0000 (21:49 +0100)]
Treat unreadable conf file like missing instead of a fatal error
This reverts 0b18af47 and implements a better solution.
The major reason is to keep ccache transparent, i.e. to still have the
following behavior:
* If ccache returns exit code == 0, then any produced stderr comes from
the compiler and only from the compiler.
* If ccache returns exit code != 0, then ccache may print error messages
of its own.
The reason is that autoconf configure scripts have been known to fail
tests if the compiler emits anything to stderr even if the produced
result actually works. (And printing to stdout is also a no-no.)
Fail if boolean env vars are set with common negative strings
Boolean environment variables have strange semantics: if the variable
is set then the configuration setting is considered "true". This means
users can easily be mistaken that eg CCACHE_DISABLE=false means that
the "disable" setting is set to false.
To avoid too much backwards-incompatibility, we now exit with an error if
some common negative-sounding (case-insensitive) values:
"0", "false", "disable", "no".
All other values (including the empty string) are still considered to mean
"true".
Joel Rosdahl [Mon, 29 Jan 2018 19:57:18 +0000 (20:57 +0100)]
test: Rearrange files into test and unittest directories
* The unit tests formerly located in the test directory have been moved
to the unittest directory.
* The integration test suite test.sh has been made a bash script and
renamed to test/run. Its test suites are located in test/suites.
Joel Rosdahl [Sat, 27 Jan 2018 21:18:37 +0000 (22:18 +0100)]
test: Split into one file per suite
The test.sh file has simply grown unpleasantly large, so it's time to
split it up. Some suites still refer to stuff defined in earlier suites,
but we'll have to live with that for now.
Clemens Rabe [Wed, 23 Aug 2017 07:33:23 +0000 (09:33 +0200)]
Bug fixes and tests for nvcc
Feature: Added cuda compiler in separate travis job and implemented
tests for nvcc.
Feature: Added support for nvcc compiler options --compiler-bindir/-ccbin,
--output-directory/-odir and --libdevice-directory/-ldir.
Added tests for these options in test.sh.
Bug fix: Original patch had a statement to avoid using the preprocessed
input files for nvcc when run_second_cpp is false. Otherwise,
when a build is necessary and the preprocessed output was used,
nvcc results with a compiler error. The patch simply ensures
run_second_cpp is always set to true for the cuda compiler.
Bug fix: The -optf and -odir options are only accepted for nvcc. For other
compilers, they behave like '-o ptf' resp. '-o dir'.
A test was added to check this behaviour.
Joel Rosdahl [Sun, 21 Jan 2018 21:17:24 +0000 (22:17 +0100)]
Refactor and clean up code for copying results to/from the cache
Lots of cruft and copy pasta has collected during the years.
* It's enough to let get_file_from_cache detect missing files in the
cache; no need to check before.
* Made the order of the handling of the different file types consistent
in various places.
* Removed the tmp_cov, tmp_su and tmp_dwo variables. I cannot
see why they just aren't redundant since the corresponding output_*
variables already exist with the same value. Except for the "GCC has
some funny rule" part, but that seems bogus anyway since tmp_* and
output_* must be equal for things to work. Let's just ignore it for
now.
* Removed the support for generating placeholders for .cov and .su files
if the compiler doesn't create them. Modern compilers always create
them, and I want to reduce code complexity.
Joel Rosdahl [Sun, 21 Jan 2018 08:34:51 +0000 (09:34 +0100)]
Improve file size/number counters for overwritten files
When ccache overwrites a cached file, the counters are still increased
as if a new file was stored in the cache, for instance when recaching.
This is now fixed by checking if a cached file exists before storing the
cached file and update file size/number counters with the correct
size/count delta.