summaryrefslogtreecommitdiff
path: root/test/libapt/fileutl_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fix FileUtlTest.GetTempDir failure when run as rootPino Toscano2015-12-191-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
* ensure FileFd doesn't try to open /dev/null as atomic and coDavid Kalnischkies2015-11-041-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
* fileutl_test.cc: Check for /etc/passwd instead of /bin/shJulian Andres Klode2015-08-101-3/+3
| | | | | | This fixes the tests on systems where usrmerge is installed. Gbp-dch: ignore
* (style) Variable 'res' is assigned a value that is never usedDavid Kalnischkies2014-11-081-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
* Division by result of sizeof(). memset() expects a size in bytesDavid Kalnischkies2014-11-081-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
* test if TMPDIR is accessible before usingDavid Kalnischkies2014-10-201-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
* Merge branch 'feature/abspath' into feature/apt-install-debMichael Vogt2014-04-281-0/+4
|\
| * fix testsMichael Vogt2014-04-281-0/+4
| |
* | Merge branch 'feature/abspath' into feature/apt-install-debMichael Vogt2014-04-281-1/+7
|\| | | | | | | | | Conflicts: test/libapt/fileutl_test.cc
| * add flAbsPath() as a wrapper to realpath()Michael Vogt2014-04-281-0/+7
| |
* | Implement Popen() execv helper to avoid popen()Michael Vogt2014-04-281-0/+48
|/
* use Google C++ Testing Framework for libapt testsDavid Kalnischkies2014-04-161-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.
* clear HitEof flag in FileFd::SeekDavid Kalnischkies2014-04-161-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'.
* extend FileFd test behond basic permission testsDavid Kalnischkies2014-04-111-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
* Fix insecure file permissions when using FileFd with OpenMode::AtomicMichael Vogt2014-04-101-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.
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-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)
* warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies2014-03-131-1/+1
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* add basic tests for GetTempDir()Michael Vogt2013-12-231-0/+13
|
* * lp:~mvo/apt/add-glob-function:Michael Vogt2013-08-151-0/+42
- add Glob() to fileutl.{cc,h} Conflicts: apt-pkg/contrib/fileutl.h debian/changelog