Skip to content

Generated test bundles are non deterministic #465

@vakhidbetrakhmadov

Description

@vakhidbetrakhmadov

#402 (9975f41) break determinism at least in test bundles.

I have been debugging determinism issues in our setup and discovered that generated test bundles always differ from each other.

I compared 2 such test bundles and discovered that they had different LC_UUID load commands.

I was able to narrow down to the commit that introduced the regression - #402 (9975f41)

# - - - - - - - - - - -
# Checkout rules_swift
# - - - - - - - - - - -
git clone https://github.com/bazelbuild/rules_swift.git
cd rules_swift

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Point apple_support at 7009b77c98a67d3fea081c9db4dbcee8effc3b7e
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
git apply <<EOF
diff --git a/MODULE.bazel b/MODULE.bazel
index 2f15a5e..8eefa02 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -11,6 +11,11 @@ module(
 bazel_dep(name = "bazel_features", version = "1.10.0")
 bazel_dep(name = "bazel_skylib", version = "1.3.0")
 bazel_dep(name = "apple_support", version = "1.21.0", repo_name = "build_bazel_apple_support")
+git_override(
+    module_name = "apple_support",
+    commit = "7009b77c98a67d3fea081c9db4dbcee8effc3b7e",
+    remote = "https://github.com/bazelbuild/apple_support.git",
+)
 bazel_dep(name = "rules_cc", version = "0.1.2")
 bazel_dep(name = "rules_shell", version = "0.3.0")
 bazel_dep(name = "platforms", version = "0.0.9")
EOF

# - - - - - - - - - - - - - - - - - - -
# Observe that LC_UUID is determenistic
# - - - - - - - - - - - - - - - - - - -
bazelisk clean &>/dev/null && bazelisk test //examples/xplatform/xctest:xctest --macos_minimum_os=14.0 &>/dev/null && otool -l bazel-bin/examples/xplatform/xctest/xctest.xctest/Contents/MacOS/xctest | grep LC_UUID -A 2
#      cmd LC_UUID
#  cmdsize 24
#     uuid C6EC028E-324A-389F-98EC-D60EC54585C2

bazelisk clean &>/dev/null && bazelisk test //examples/xplatform/xctest:xctest --macos_minimum_os=14.0 &>/dev/null && otool -l bazel-bin/examples/xplatform/xctest/xctest.xctest/Contents/MacOS/xctest | grep LC_UUID -A 2
#      cmd LC_UUID
#  cmdsize 24
#     uuid C6EC028E-324A-389F-98EC-D60EC54585C2

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Point apple_support at 9975f41a628bcadb455b983bf8e3af4a0c0ac568
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
git checkout -- .
git apply <<EOF
diff --git a/MODULE.bazel b/MODULE.bazel
index 2f15a5e..73f8387 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -11,6 +11,11 @@ module(
 bazel_dep(name = "bazel_features", version = "1.10.0")
 bazel_dep(name = "bazel_skylib", version = "1.3.0")
 bazel_dep(name = "apple_support", version = "1.21.0", repo_name = "build_bazel_apple_support")
+git_override(
+    module_name = "apple_support",
+    commit = "9975f41a628bcadb455b983bf8e3af4a0c0ac568",
+    remote = "https://github.com/bazelbuild/apple_support.git",
+)
 bazel_dep(name = "rules_cc", version = "0.1.2")
 bazel_dep(name = "rules_shell", version = "0.3.0")
 bazel_dep(name = "platforms", version = "0.0.9")
EOF

# - - - - - - - - - - - - - - - - - - - - -
# Observe that LC_UUID is NON-determenistic
# - - - - - - - - - - - - - - - - - - - - -
bazelisk clean &>/dev/null && bazelisk test //examples/xplatform/xctest:xctest --macos_minimum_os=14.0 &>/dev/null && otool -l bazel-bin/examples/xplatform/xctest/xctest.xctest/Contents/MacOS/xctest | grep LC_UUID -A 2
#      cmd LC_UUID
#  cmdsize 24
#     uuid 12176ADC-1B10-3D2B-A1FC-13382069AEC6

bazelisk clean &>/dev/null && bazelisk test //examples/xplatform/xctest:xctest --macos_minimum_os=14.0 &>/dev/null && otool -l bazel-bin/examples/xplatform/xctest/xctest.xctest/Contents/MacOS/xctest | grep LC_UUID -A 2
#      cmd LC_UUID
#  cmdsize 24
#     uuid C848922F-171C-37A5-9334-AAFF48976706

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions