kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] 02/02: mini_chronyd: switch to using symbolic links
Date Wed, 13 Nov 2019 15:03:18 GMT
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit f769f1db64076809486ec4bb6b4f39ff6c5bb1b7
Author: Adar Dembo <adar@cloudera.com>
AuthorDate: Sun Nov 10 01:12:35 2019 -0800

    mini_chronyd: switch to using symbolic links
    
    The one gotcha is that the symbolic links won't exist a priori in a remote
    dist-test machine, which causes MiniChronyd::GetPath to fail to find the
    chrony binaries. To fix this, run_dist_test.py must recreate the links.
    
    Change-Id: Id24d97d2badfee3e121f01a5280a2879513782de
    Reviewed-on: http://gerrit.cloudera.org:8080/14684
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
---
 build-support/run_dist_test.py | 10 +++++++++-
 src/kudu/clock/CMakeLists.txt  | 16 ++++++++--------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/build-support/run_dist_test.py b/build-support/run_dist_test.py
index a3a4138..7bd7620 100755
--- a/build-support/run_dist_test.py
+++ b/build-support/run_dist_test.py
@@ -153,9 +153,17 @@ def main():
   env['SENTRY_HOME'] = glob.glob(os.path.join(ROOT, "thirdparty/src/sentry-*"))[0]
   env['JAVA_HOME'] = glob.glob("/usr/lib/jvm/java-1.8.0-*")[0]
 
+  # Restore the symlinks to the chrony binaries; tests expect to find them in
+  # same directory as the test binaries themselves.
+  for bin_path in glob.glob(os.path.join(ROOT, "build/*/bin")):
+    os.symlink(os.path.join(ROOT, "thirdparty/installed/common/bin/chronyc"),
+               os.path.join(bin_path, "chronyc"))
+    os.symlink(os.path.join(ROOT, "thirdparty/installed/common/sbin/chronyd"),
+               os.path.join(bin_path, "chronyd"))
+
   env['LD_LIBRARY_PATH'] = ":".join(
     [os.path.join(ROOT, "build/dist-test-system-libs/")] +
-    glob.glob(os.path.abspath((os.path.join(ROOT, "build/*/lib")))))
+    glob.glob(os.path.abspath(os.path.join(ROOT, "build/*/lib"))))
 
   # Don't pollute /tmp in dist-test setting. If a test crashes, the dist-test slave
   # will clear up our working directory but won't be able to find and clean up things
diff --git a/src/kudu/clock/CMakeLists.txt b/src/kudu/clock/CMakeLists.txt
index ddb09f4..b0e9d85 100644
--- a/src/kudu/clock/CMakeLists.txt
+++ b/src/kudu/clock/CMakeLists.txt
@@ -38,14 +38,14 @@ target_link_libraries(clock
 ##############################
 
 if (NOT NO_CHRONY)
-  # These are copied/installed instead of linking because:
-  #  * symlinks would not work with dist-test
-  #  * hardlinks would not work if the target directory is at different
-  #    filesystem than thirdparty
-  file(COPY "${CMAKE_SOURCE_DIR}/thirdparty/installed/common/bin/chronyc"
-    DESTINATION "${EXECUTABLE_OUTPUT_PATH}")
-  file(COPY "${CMAKE_SOURCE_DIR}/thirdparty/installed/common/sbin/chronyd"
-    DESTINATION "${EXECUTABLE_OUTPUT_PATH}")
+  # Link the chrony binaries so that they can be found via
+  # MiniChronyd::GetPath in MiniChronyd::Start.
+  execute_process(COMMAND ln -nsf
+                  "${CMAKE_SOURCE_DIR}/thirdparty/installed/common/bin/chronyc"
+                  "${EXECUTABLE_OUTPUT_PATH}/chronyc")
+  execute_process(COMMAND ln -nsf
+                  "${CMAKE_SOURCE_DIR}/thirdparty/installed/common/sbin/chronyd"
+                  "${EXECUTABLE_OUTPUT_PATH}/chronyd")
 
   set(MINI_CHRONYD_SRCS test/mini_chronyd.cc)
 


Mime
View raw message