Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert pkg_deb tests from shell to python #211

Merged
merged 8 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .bazelci/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ tasks:
working_directory: ../pkg
test_targets:
- "..."
# This uses dpkg-deb(1), which is not available by default in macOS
- "-//tests:build_test_deb"
# rpmbuild(8) is not available by default on macOS
- "-//tests:make_rpm_test"
- "-//experimental/tests:pkg_rpm_basic_test"
windows:
working_directory: ../pkg
# We can not build any RPM files or do the .deb tests.
# We can not build any RPM files.
# Also, many other tests are simply broken on windows. So we start with the
# one that works and can add to the list as we fix the broken behavior or
# broken test.
test_targets:
- "//tests:zip_test"
- "//tests:pkg_deb_test"

30 changes: 10 additions & 20 deletions pkg/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

licenses(["notice"])

load("//:pkg.bzl", "pkg_deb", "pkg_tar", "pkg_zip")
Expand Down Expand Up @@ -176,12 +177,6 @@ py_test(
],
)

genrule(
name = "test-deb-preinst",
outs = ["test-deb.preinst"],
cmd = "echo -n \"#!/usr/bin/env bash\n# tete ®, Й, ק ,م, ๗, あ, 叶, 葉, 말, ü and é\necho fnord\" > \"$@\"",
)

pkg_deb(
name = "test-deb",
breaks = ["oldbrokenpkg"],
Expand All @@ -201,7 +196,7 @@ pkg_deb(
maintainer = "somé[email protected]",
make_deb = "//:make_deb",
package = "titi",
preinst = ":test-deb-preinst",
preinst = "testdata/deb_preinst",
replaces = ["oldpkg"],
templates = ":testdata/templates",
urgency = "low",
Expand Down Expand Up @@ -236,7 +231,7 @@ pkg_deb(
maintainer = "somé[email protected]",
make_deb = "//:make_deb_py2",
package = "titi",
preinst = ":test-deb-preinst",
preinst = "testdata/deb_preinst",
replaces = ["oldpkg"],
templates = ":testdata/templates",
urgency = "low",
Expand Down Expand Up @@ -370,25 +365,20 @@ py_test(
python_version = "PY3",
)

sh_test(
name = "build_test_deb",
py_test(
name = "pkg_deb_test",
size = "medium",
srcs = [
"build_test_deb.sh",
"pkg_deb_test.py",
],
python_version = "PY3",
data = [
"testenv.sh",
":test-deb.deb",
":test-deb-py2.deb",
":titi_test_all.deb",
":titi_test_all.changes",
],
tags = [
# dpkg tools are only available on debian
"no_macos",
"no_windows",
],
deps = [
"@rules_pkg//third_party/bazel/src/test/shell:bashunit",
"//:archive",
"@bazel_tools//tools/python/runfiles",
],
)

Expand Down
172 changes: 0 additions & 172 deletions pkg/tests/build_test_deb.sh

This file was deleted.

Loading