aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-09-30 10:32:28 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-10-01 12:21:31 -0700
commit73dd21036cab021b5eed57cb4ffdd3c41daa1ad8 (patch)
tree26a78c3474d95499051276a015573e7bc2024fbd /unittests
parentbd2fcb268b9ff48797bebb6a2ef94d2741234191 (diff)
downloadmeson-73dd21036cab021b5eed57cb4ffdd3c41daa1ad8.zip
meson-73dd21036cab021b5eed57cb4ffdd3c41daa1ad8.tar.gz
meson-73dd21036cab021b5eed57cb4ffdd3c41daa1ad8.tar.bz2
rust: dependencies need to cause a rebuild/relink not just reorder
Otherwise changes to a dependency don't propogate
Diffstat (limited to 'unittests')
-rw-r--r--unittests/allplatformstests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index b8cdfb6..5ae33fe 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from mesonbuild.mesonlib.universal import windows_proof_rm
import subprocess
import re
import json
@@ -4062,6 +4063,37 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.assertIn('error: use of a blacklisted/placeholder name `foo`', cm.exception.stdout)
+ @skip_if_not_language('rust')
+ def test_rust_rlib_linkage(self) -> None:
+ if self.backend is not Backend.ninja:
+ raise unittest.SkipTest('Rust is only supported with ninja currently')
+ template = textwrap.dedent('''\
+ use std::process::exit;
+
+ pub fn fun() {{
+ exit({});
+ }}
+ ''')
+
+ testdir = os.path.join(self.unit_test_dir, '100 rlib linkage')
+ gen_file = os.path.join(testdir, 'lib.rs')
+ with open(gen_file, 'w') as f:
+ f.write(template.format(0))
+ self.addCleanup(windows_proof_rm, gen_file)
+
+ self.init(testdir)
+ self.build()
+ self.run_tests()
+
+ with open(gen_file, 'w') as f:
+ f.write(template.format(39))
+
+ self.build()
+ with self.assertRaises(subprocess.CalledProcessError) as cm:
+ self.run_tests()
+ self.assertEqual(cm.exception.returncode, 1)
+ self.assertIn('exit status 39', cm.exception.stdout)
+
def test_custom_target_name(self):
testdir = os.path.join(self.unit_test_dir, '99 custom target name')
self.init(testdir)