summaryrefslogtreecommitdiff
path: root/test/libapt/fileutl_test.cc
AgeCommit message (Collapse)AuthorFilesLines
2015-12-19Fix FileUtlTest.GetTempDir failure when run as rootPino Toscano1-3/+7
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 Kalnischkies1-0/+30
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 Klode1-3/+3
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 Kalnischkies1-13/+16
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 Kalnischkies1-2/+7
"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 Kalnischkies1-1/+9
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 Vogt1-0/+4
2014-04-28fix testsMichael Vogt1-0/+4
2014-04-28Merge branch 'feature/abspath' into feature/apt-install-debMichael Vogt1-1/+7
Conflicts: test/libapt/fileutl_test.cc
2014-04-28add flAbsPath() as a wrapper to realpath()Michael Vogt1-0/+7
2014-04-28Implement Popen() execv helper to avoid popen()Michael Vogt1-0/+48
2014-04-16use Google C++ Testing Framework for libapt testsDavid Kalnischkies1-141/+131
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 Kalnischkies1-24/+86
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 Kalnischkies1-10/+99
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 Vogt1-0/+31
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 Kalnischkies1-4/+3
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 Kalnischkies1-1/+1
Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
2013-12-23add basic tests for GetTempDir()Michael Vogt1-0/+13
2013-08-15* lp:~mvo/apt/add-glob-function:Michael Vogt1-0/+42
- add Glob() to fileutl.{cc,h} Conflicts: apt-pkg/contrib/fileutl.h debian/changelog