From 023c4da591e0f90f2021b2e222843a631c40b226 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 14 Nov 2022 22:37:17 -0800 Subject: [PATCH] Enabled TAP testing for upb on Windows via Lexan. We disable targets that are not currently working on Windows. PiperOrigin-RevId: 488560033 --- BUILD | 17 +++++++++++++++++ python/BUILD | 4 ++++ python/pb_unit_tests/pyproto_test_wrapper.bzl | 4 ++++ python/py_extension.bzl | 3 ++- upb/hash/test.cc | 7 ------- upb/util/BUILD | 5 +++++ upbc/BUILD | 4 ++++ 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/BUILD b/BUILD index ff484fe4ed..7c47752c20 100644 --- a/BUILD +++ b/BUILD @@ -614,6 +614,11 @@ cc_test( "upb/reflection/def_builder_test.cc", "upb/reflection/def_type.h", ], + # TODO(b/259158612): fix this test on Windows. + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = [ ":descriptor_upb_proto", ":hash", @@ -887,6 +892,10 @@ cc_binary( srcs = ["upb/conformance_upb.c"], copts = UPB_DEFAULT_COPTS, data = ["upb/conformance_upb_failures.txt"], + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = [ ":conformance_proto_upb", ":conformance_proto_upbdefs", @@ -917,6 +926,10 @@ sh_test( ":conformance_upb", "@com_google_protobuf//conformance:conformance_test_runner", ], + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = ["@bazel_tools//tools/bash/runfiles"], ) @@ -928,6 +941,10 @@ cc_binary( "-DREBUILD_MINITABLES", ], data = ["upb/conformance_upb_failures.txt"], + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = [ ":conformance_proto_upb", ":conformance_proto_upbdefs", diff --git a/python/BUILD b/python/BUILD index 0c0d64a023..c20bd70145 100644 --- a/python/BUILD +++ b/python/BUILD @@ -202,6 +202,10 @@ py_extension( # casts between function pointers and object pointers. "-Wno-pedantic", ], + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = [ "//:collections", "//:descriptor_upb_proto_reflection", diff --git a/python/pb_unit_tests/pyproto_test_wrapper.bzl b/python/pb_unit_tests/pyproto_test_wrapper.bzl index 8ea38789c0..bda44e95d7 100644 --- a/python/pb_unit_tests/pyproto_test_wrapper.bzl +++ b/python/pb_unit_tests/pyproto_test_wrapper.bzl @@ -31,6 +31,10 @@ def pyproto_test_wrapper(name, deps = []): # "//net/proto2/python/internal:" + name + "_for_deps", # "//net/proto2/python/public:use_upb_protos", # ], +# target_compatible_with = select({ +# "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], +# "//conditions:default": [], +# }), # ) # # end:google_only diff --git a/python/py_extension.bzl b/python/py_extension.bzl index e41b22415c..7b918bc78e 100644 --- a/python/py_extension.bzl +++ b/python/py_extension.bzl @@ -2,7 +2,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") -def py_extension(name, srcs, copts, deps = []): +def py_extension(name, srcs, copts, deps = [], **kwargs): """Creates a C++ library to extend python Args: @@ -38,6 +38,7 @@ def py_extension(name, srcs, copts, deps = []): "//python:limited_api_3.10_win64": ["@nuget_python_x86-64_3.10.0//:python_limited_api"], "//conditions:default": ["@system_python//:python_headers"], }), + **kwargs ) EXT_SUFFIX = ".abi3.so" diff --git a/upb/hash/test.cc b/upb/hash/test.cc index 63544d66e5..b1c10f7690 100644 --- a/upb/hash/test.cc +++ b/upb/hash/test.cc @@ -27,7 +27,6 @@ #include #include -#include #include #include @@ -357,12 +356,6 @@ class TypedIntTable { using std::vector; -double get_usertime() { - struct rusage usage; - getrusage(RUSAGE_SELF, &usage); - return usage.ru_utime.tv_sec + (usage.ru_utime.tv_usec / 1000000.0); -} - TEST(Table, StringTable) { vector keys; keys.push_back("google.protobuf.FileDescriptorSet"); diff --git a/upb/util/BUILD b/upb/util/BUILD index 0270ec8793..be57ce4671 100644 --- a/upb/util/BUILD +++ b/upb/util/BUILD @@ -115,6 +115,11 @@ cc_library( cc_test( name = "compare_test", srcs = ["compare_test.cc"], + # TODO(b/259158757): fix this test on Windows. + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), deps = [ ":compare", "//:wire_internal", diff --git a/upbc/BUILD b/upbc/BUILD index aaee51414f..38d1e1ae0c 100644 --- a/upbc/BUILD +++ b/upbc/BUILD @@ -176,6 +176,10 @@ cc_binary( "subprocess.h", ], copts = UPB_DEFAULT_CPPOPTS, + target_compatible_with = select({ + "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"], + "//conditions:default": [], + }), visibility = ["//visibility:public"], deps = [ ":code_generator_request_upb_proto",