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 96aafc4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 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
9 changes: 9 additions & 0 deletions test cases/common/8 install/gendir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3

import sys, os

dirname = sys.argv[1]
fname = os.path.join(dirname, 'file.txt')
print(f'creating {dirname=}, {fname=}')
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'))

0 comments on commit 96aafc4

Please sign in to comment.