Skip to content

Commit

Permalink
add test case for installed targets uninstalling a single directory
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-schwartz committed Mar 19, 2021
1 parent 0ad870f commit f7b0238
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2496,13 +2496,15 @@ 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)
self.install()
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')
Expand Down
8 changes: 8 additions & 0 deletions test cases/common/8 install/gendir.py
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 6 additions & 0 deletions test cases/common/8 install/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
7 changes: 4 additions & 3 deletions test cases/common/8 install/test.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit f7b0238

Please sign in to comment.