summaryrefslogtreecommitdiff
path: root/test/libapt/fileutl_test.cc
AgeCommit message (Collapse)Author
2017-06-26Refactor to avoid loop/dangling gcc warningsDavid Kalnischkies
Gbp-Dch: Ignore
2016-08-10CMake: Add unit testsJulian Andres Klode
Add support for our GTest based unit tests. By default, CMake will look in /usr/src/gtest for the external GTest project, but this can be overriden by defining GTEST_ROOT when invoking cmake. Gbp-Dch: ignore
2016-06-29don't do atomic overrides with failed filesDavid Kalnischkies
We deploy atomic renames for some files, but these renames also happen if something about the file failed which isn't really the point of the exercise… Closes: 828908
2016-05-27fix and document on the fly compressor configDavid Kalnischkies
libapt allows to configure compressors to be used by its system via configuration implemented in 03bef78461c6f443187b60799402624326843396, but that was never really documented and also only partly working, which also explains why the tests weren't using it…
2016-02-10test that seeking to a position earlier in the file worksJulian Andres Klode
This tests the fix for #812994, #813000 Gbp-Dch: ignore
2015-12-19Fix FileUtlTest.GetTempDir failure when run as rootPino Toscano
Testing /usr as TMPDIR assumes that GetTempDir() cannot use it because it cannot write to it; this is true for non-root users, but not so much for root. Since root can access everything, perform this particular test case only when not running as root. Closes: #808383
2015-11-04ensure FileFd doesn't try to open /dev/null as atomic and coDavid Kalnischkies
The wrapping will fail in the best case and actually end up deleting /dev/null in the worst case. Given that there is no point in trying to write atomically to /dev/null as you can't read from it again just ignore these flags if higher level code ends up trying to use them on /dev/null. Git-Dch: Ignore
2015-08-10fileutl_test.cc: Check for /etc/passwd instead of /bin/shJulian Andres Klode
This fixes the tests on systems where usrmerge is installed. Gbp-dch: ignore
2014-11-08(style) Variable 'res' is assigned a value that is never usedDavid Kalnischkies
Checking the return value of this (and many other calls) in this testcase is a good idea, so we do it now. Reported-By: cppcheck Git-Dch: Ignore
2014-11-08Division by result of sizeof(). memset() expects a size in bytesDavid Kalnischkies
"did you intend to multiply instead?" is what cppcheck helpful says and it is absolutely right. Doesn't make a whole lot of a difference though as we are talking about 'char' in this testcase, but just to be sure. Reported-By: cppcheck Git-Dch: Ignore
2014-10-20test if TMPDIR is accessible before usingDavid Kalnischkies
Private temporary directories as created by e.g. libpam-tmpdir are nice, but they are also very effective in preventing our priviledge dropping to work as TMPDIR will be set to a directory only root has access to, so working with it as _apt will fail. We circumvent this by extending our check for a usable TMPDIR setting by checking access rights. Closes: 765951
2014-04-28Merge branch 'feature/abspath' into feature/apt-install-debMichael Vogt
2014-04-28fix testsMichael Vogt
2014-04-28Merge branch 'feature/abspath' into feature/apt-install-debMichael Vogt
Conflicts: test/libapt/fileutl_test.cc
2014-04-28add flAbsPath() as a wrapper to realpath()Michael Vogt
2014-04-28Implement Popen() execv helper to avoid popen()Michael Vogt
2014-04-16use Google C++ Testing Framework for libapt testsDavid Kalnischkies
My commit 45df0ad2 from 26. Nov 2009 had a little remark: "The commit also includes a very very simple testapp." This was never intended to be permanent, but as usually… The commit adds the needed make magic to compile gtest statically as it is required and links it against a small runner. All previous testcase binaries are reimplemented in gtest and combined in this runner. While most code is a 1:1 translation some had to be rewritten like compareversion_test.cc, but the coverage remains the same.
2014-04-16clear HitEof flag in FileFd::SeekDavid Kalnischkies
fseek and co do this to their eof-flags and it is more logic this way as we will usually seek away from the end (e.g. to re-read the file). The commit also improves the testcase further and adds a test for the binary compressor codepath (as gz, bzip2 and xz are handled by libraries) via the use of 'rev' as a 'compressor'.
2014-04-11extend FileFd test behond basic permission testsDavid Kalnischkies
We now do Open, Write and Read (the later multiple ways) for each permission and each compressor we have configured to cover more cases and especially ensure that compressors do not change our premissions. This test is also to be credited for discovering the skippos-fix. Git-Dch: Ignore
2014-04-10Fix insecure file permissions when using FileFd with OpenMode::AtomicMichael Vogt
Commit 7335eebea6dd43581d4650a8818b06383ab89901 introduced a bug that caused FileFd to create insecure permissions when FileFd::Atomic is used. This commit fixes the permissions and adds a test. The bug is most likely caused by the confusing "Perm" parameter that is passed to Open() - its not the file permissions but intead the "mode" part of open/creat.
2014-03-13cleanup headers and especially #includes everywhereDavid Kalnischkies
Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
2014-03-13warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies
Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
2013-12-23add basic tests for GetTempDir()Michael Vogt
2013-08-15* lp:~mvo/apt/add-glob-function:Michael Vogt
- add Glob() to fileutl.{cc,h} Conflicts: apt-pkg/contrib/fileutl.h debian/changelog