| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| DEPS = [ |
| "fuchsia/cipd_ensure", |
| ] |
| |
| |
| def RunSteps(api): |
| test_cases = [ |
| [ |
| ["fuchsia/foo/xyz"], |
| [], |
| [ |
| "fuchsia/foo/xyz", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/xyz"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/xyz", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${platform}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-amd64", |
| "fuchsia/foo/linux-arm64", |
| "fuchsia/foo/mac-amd64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${os}-${arch}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-amd64", |
| "fuchsia/foo/linux-arm64", |
| "fuchsia/foo/mac-amd64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${os=linux,mac}-amd64"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-amd64", |
| "fuchsia/foo/mac-amd64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${os=linux}-${arch=amd64}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-amd64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${os=linux,mac}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux", |
| "fuchsia/foo/mac", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${arch=amd64,arm64}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/amd64", |
| "fuchsia/foo/arm64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/linux-${arch=amd64,arm64}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-amd64", |
| "fuchsia/foo/linux-arm64", |
| ], |
| ], |
| [ |
| ["fuchsia/foo/${os=linux,mac}-${arch=arm64}"], |
| ["linux-amd64", "linux-arm64", "mac-amd64"], |
| [ |
| "fuchsia/foo/linux-arm64", |
| ], |
| ], |
| ] |
| for packages, platforms, expected_packages in test_cases: |
| expanded_packages = api.cipd_ensure.expand_packages_by_platforms( |
| packages=packages, |
| platforms=platforms, |
| ) |
| assert ( |
| expanded_packages == expected_packages |
| ), f"expected {expected_packages}, got {expanded_packages}" |
| |
| |
| def GenTests(api): |
| yield api.test("basic") |