aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-11-07 10:28:20 +0200
committerGitHub <noreply@github.com>2018-11-07 10:28:20 +0200
commit996f07c546d6e82b0648a1d9f81d7474b1bec76e (patch)
treee9f6f8f58f605741ad578d01ab0d8708f75c235c /run_unittests.py
parente921e38301a54b111c7606aa30d718c856140e47 (diff)
parenta173dbf7724b71771fac51e2fcf316b5bfa59848 (diff)
downloadmeson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.zip
meson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.tar.gz
meson-996f07c546d6e82b0648a1d9f81d7474b1bec76e.tar.bz2
Merge pull request #4356 from xclaesse/wipe
Add --wipe command line option
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 5574b5f..d63a961 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -25,6 +25,7 @@ import shutil
import sys
import unittest
import platform
+import pickle
from itertools import chain
from unittest import mock
from configparser import ConfigParser
@@ -2778,6 +2779,41 @@ recommended as it is not supported on some platforms''')
self.wipe()
self.init(testdir, extra_args=['-Dstart_native=true'])
+ def test_reconfigure(self):
+ testdir = os.path.join(self.unit_test_dir, '46 reconfigure')
+ self.init(testdir, extra_args=['-Dopt1=val1'])
+ self.setconf('-Dopt2=val2')
+
+ # Set an older version to force a reconfigure from scratch
+ filename = os.path.join(self.privatedir, 'coredata.dat')
+ with open(filename, 'rb') as f:
+ obj = pickle.load(f)
+ obj.version = '0.47.0'
+ with open(filename, 'wb') as f:
+ pickle.dump(obj, f)
+
+ out = self.init(testdir, extra_args=['--reconfigure', '-Dopt3=val3'])
+ self.assertRegex(out, 'WARNING:.*Regenerating configuration from scratch')
+ self.assertRegex(out, 'opt1 val1')
+ self.assertRegex(out, 'opt2 val2')
+ self.assertRegex(out, 'opt3 val3')
+ self.assertRegex(out, 'opt4 default4')
+ self.build()
+ self.run_tests()
+
+ # Create a file in builddir and verify wipe command removes it
+ filename = os.path.join(self.builddir, 'something')
+ open(filename, 'w').close()
+ self.assertTrue(os.path.exists(filename))
+ out = self.init(testdir, extra_args=['--wipe', '-Dopt4=val4'])
+ self.assertFalse(os.path.exists(filename))
+ self.assertRegex(out, 'opt1 val1')
+ self.assertRegex(out, 'opt2 val2')
+ self.assertRegex(out, 'opt3 val3')
+ self.assertRegex(out, 'opt4 val4')
+ self.build()
+ self.run_tests()
+
class FailureTests(BasePlatformTests):
'''
Tests that test failure conditions. Build files here should be dynamically