[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master fd0d642 1/2: Fix some unit-test wine failures
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master fd0d642 1/2: Fix some unit-test wine failures |
Date: |
Fri, 6 Jan 2017 12:42:47 +0000 (UTC) |
branch: master
commit fd0d64239b7590787f5b8799c1c72222500c5136
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Fix some unit-test wine failures
See:
http://lists.nongnu.org/archive/html/lmi/2017-01/msg00015.html
* README.schroot: make an already-present msw binary available to wine
* install_miscellanea.make: improve documentation for that msw binary
* system_command_test.cpp: use that binary because it is now available
---
README.schroot | 12 ++++++++++++
install_miscellanea.make | 7 ++++---
system_command_test.cpp | 17 +++++++++++------
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/README.schroot b/README.schroot
index 40fdd84..285b2b2 100644
--- a/README.schroot
+++ b/README.schroot
@@ -249,6 +249,18 @@ chmod +x install_msw.sh
pushd /opt/lmi/bin
wine ./lmi_wx_shared.exe --ash_nazg --data_path=../data
+# '--host' being 'i686-w64-mingw32', unit tests require an msw-native
+# 'md5sum.exe'. Fortuitously, 'install_miscellanea.make' has installed
+# one already, taking care to place it off $PATH so that it doesn't
+# shadow a native 'md5sum' provided, e.g., by cygwin. However, in this
+# chroot it cannot shadow the native GNU/Linux 'md5sum', so copy it to
+# a directory that's on $WINEPATH to make unit tests work; it doesn't
+# matter that this directory is also on $PATH. The file is tiny, so a
+# copy isn't too wasteful, and wine doesn't find it if it's simply
+# symlinked.
+
+cp -a /opt/lmi/third_party/bin/md5sum.exe /opt/lmi/local/bin
+
# Symlink the repository's hooks/ directory:
cd /opt/lmi/src/lmi
ln --symbolic --force --no-dereference ../hooks .git
diff --git a/install_miscellanea.make b/install_miscellanea.make
index 0e9b8d3..21e97a9 100644
--- a/install_miscellanea.make
+++ b/install_miscellanea.make
@@ -188,9 +188,10 @@ jing: $(file_list)
$(MV) scratch/$(stem)/bin/address@hidden $(destination)/rng
$(MV) scratch/$(stem)/bin/xercesImpl.jar $(destination)/rng
-# The 'md5sum_msw' binary is required only by the msw-specific
-# 'fardel' target. On other platforms, it can't be executed, but it
-# could be used to create a cross 'fardel'.
+# The 'md5sum_msw' binary is redistributed to msw end users for
+# authentication, so the 'fardel' target requires it. On other
+# platforms, it cannot be executed directly, but it is needed for
+# creating a cross 'fardel' and for running cross unit tests.
#
# It is placed in lmi's 'third_party/bin/' subdirectory--imperatively
# not in lmi's 'local/bin/' subdirectory, which is added to $PATH.
diff --git a/system_command_test.cpp b/system_command_test.cpp
index b2ea558..a51ece7 100644
--- a/system_command_test.cpp
+++ b/system_command_test.cpp
@@ -31,16 +31,20 @@
int test_main(int, char*[])
{
- std::ofstream os("eraseme", ios_out_trunc_binary());
- os << "abc\n";
- os.close();
+ std::ofstream os0("eraseme", ios_out_trunc_binary());
+ os0 << "0123456789abcdef0123456789abcdef eraseme\n";
+ os0.close();
- system_command("grep --quiet abc eraseme");
+ std::ofstream os1("eraseme.md5", ios_out_trunc_binary());
+ os1 << "e87dfb7b7c7f87985d3eff4782c172b8 eraseme\n";
+ os1.close();
+
+ system_command("md5sum --check --status eraseme.md5");
BOOST_TEST_THROW
- (system_command("grep --quiet xyz eraseme")
+ (system_command("md5sum --check --status eraseme")
,std::runtime_error
- ,"Exit code 1 from command 'grep --quiet xyz eraseme'."
+ ,"Exit code 1 from command 'md5sum --check --status eraseme'."
);
BOOST_TEST_THROW
@@ -50,6 +54,7 @@ int test_main(int, char*[])
);
std::remove("eraseme");
+ std::remove("eraseme.md5");
return 0;
}