From f7b0238ed67fc0c9e3cef38090983e33b40fa205 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 18 Mar 2021 21:29:03 -0400 Subject: [PATCH] add test case for installed targets uninstalling a single directory --- run_unittests.py | 2 ++ test cases/common/8 install/gendir.py | 8 ++++++++ test cases/common/8 install/meson.build | 6 ++++++ test cases/common/8 install/test.json | 7 ++++--- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100755 test cases/common/8 install/gendir.py diff --git a/run_unittests.py b/run_unittests.py index 82689be8a0c9..ef4a786a0d9b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2496,6 +2496,7 @@ def read_logs(): def test_uninstall(self): exename = os.path.join(self.installdir, 'usr/bin/prog' + exe_suffix) + dirname = os.path.join(self.installdir, 'usr/share/dir') testdir = os.path.join(self.common_test_dir, '8 install') self.init(testdir) self.assertPathDoesNotExist(exename) @@ -2503,6 +2504,7 @@ def test_uninstall(self): self.assertPathExists(exename) self.uninstall() self.assertPathDoesNotExist(exename) + self.assertPathDoesNotExist(dirname) def test_forcefallback(self): testdir = os.path.join(self.unit_test_dir, '31 forcefallback') diff --git a/test cases/common/8 install/gendir.py b/test cases/common/8 install/gendir.py new file mode 100755 index 000000000000..b42327db3d1d --- /dev/null +++ b/test cases/common/8 install/gendir.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys, os + +dirname = sys.argv[1] +fname = os.path.join(dirname, 'file.txt') +os.makedirs(dirname, exist_ok=True) +open(fname, 'w').close() diff --git a/test cases/common/8 install/meson.build b/test cases/common/8 install/meson.build index 12ad38948da3..6eb5ba5ef062 100644 --- a/test cases/common/8 install/meson.build +++ b/test cases/common/8 install/meson.build @@ -2,3 +2,9 @@ project('install test', 'c', default_options : ['libdir=libtest']) stlib = static_library('stat', 'stat.c', install : true) exe = executable('prog', 'prog.c', install : true) + +dirtarget = custom_target('dirtarget', + output: ['dir'], + install: true, + command: [find_program('gendir.py'), '@OUTPUT@'], + install_dir: get_option('datadir')) diff --git a/test cases/common/8 install/test.json b/test cases/common/8 install/test.json index d2b1c63ce45c..b31f28782226 100644 --- a/test cases/common/8 install/test.json +++ b/test cases/common/8 install/test.json @@ -1,8 +1,9 @@ { "installed": [ - { "type": "exe", "file": "usr/bin/prog" }, - { "type": "pdb", "file": "usr/bin/prog" }, - { "type": "file", "file": "usr/libtest/libstat.a" } + { "type": "exe", "file": "usr/bin/prog" }, + { "type": "pdb", "file": "usr/bin/prog" }, + { "type": "file", "file": "usr/share/dir/file.txt" }, + { "type": "file", "file": "usr/libtest/libstat.a" } ], "do_not_set_opts": ["libdir"] }