[pacman-dev] [PATCH 1/5] Add the unit tests for -Qk and -Qkk that are possible now.

Allan McRae allan at archlinux.org
Mon Dec 30 21:15:44 EST 2013


On 31/12/13 04:17, Andrew Gregory wrote:
> On 11/11/13 at 06:47am, Jeremy Heiner wrote:
>> The -Qk test (001) validates the existence of the package files (which
>> were installed to the filesystem by the framework because the package
>> was added to the "local" db).
>>
>> The -Qkk test (002) does not validate any file's properties - it can
>> only check that the pacman run produces the expected warning message
>> saying that the package lacks an mtree.
>>
>> Further tests will require modifications to the testing framework to
>> allow intentional damage to the filesystem and generating an mtree.
>>
>> Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
>> ---
>>  test/pacman/tests/TESTS            |  2 ++
>>  test/pacman/tests/querycheck001.py | 15 +++++++++++++++
>>  test/pacman/tests/querycheck002.py | 15 +++++++++++++++
>>  3 files changed, 32 insertions(+)
>>  create mode 100644 test/pacman/tests/querycheck001.py
>>  create mode 100644 test/pacman/tests/querycheck002.py
>>
>> diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
>> index fc6a7e8..0997f58 100644
>> --- a/test/pacman/tests/TESTS
>> +++ b/test/pacman/tests/TESTS
>> @@ -88,6 +88,8 @@ TESTS += test/pacman/tests/query007.py
>>  TESTS += test/pacman/tests/query010.py
>>  TESTS += test/pacman/tests/query011.py
>>  TESTS += test/pacman/tests/query012.py
>> +TESTS += test/pacman/tests/querycheck001.py
>> +TESTS += test/pacman/tests/querycheck002.py
>>  TESTS += test/pacman/tests/reason001.py
>>  TESTS += test/pacman/tests/remove001.py
>>  TESTS += test/pacman/tests/remove002.py
>> diff --git a/test/pacman/tests/querycheck001.py b/test/pacman/tests/querycheck001.py
>> new file mode 100644
>> index 0000000..21bcba2
>> --- /dev/null
>> +++ b/test/pacman/tests/querycheck001.py
>> @@ -0,0 +1,15 @@
>> +self.description = "Query--check files, all there"
>> +
>> +pkg = pmpkg("dummy")
>> +pkg.files = [
>> +    "usr/lib/libdummy.so.0",
>> +    "usr/lib/libdummy.so -> libdummy.so.0",
>> +    "usr/share/dummy/C/",
>> +    "usr/share/dummy/C/msgs",
>> +    "usr/share/dummy/en -> C"]
>> +self.addpkg2db("local",pkg)
>> +
>> +self.args = "-Qk"
>> +
>> +self.addrule("PACMAN_RETCODE=0")
>> +self.addrule("!PACMAN_OUTPUT=warning")
> 
> This fails if pacman is built without libcurl.
> 

Change made:

-self.addrule("!PACMAN_OUTPUT=warning")
+self.addrule("!PACMAN_OUTPUT=warning.*(No such file or directory)")





More information about the pacman-dev mailing list