From a3d0de5ab686cbbbe4d9498090d89719da02f50c Mon Sep 17 00:00:00 2001 From: ddval <10481361+ddval@user.noreply.gitee.com> Date: Wed, 11 Jun 2025 11:27:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9B=B8=E5=85=B3=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/rocksdb/rocksdb/appveyor.yml | 77 ++++++++++++++++++++++++++++ storage/rocksdb/rocksdb/defs.bzl | 56 ++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 storage/rocksdb/rocksdb/appveyor.yml create mode 100644 storage/rocksdb/rocksdb/defs.bzl diff --git a/storage/rocksdb/rocksdb/appveyor.yml b/storage/rocksdb/rocksdb/appveyor.yml new file mode 100644 index 000000000..29f715cd6 --- /dev/null +++ b/storage/rocksdb/rocksdb/appveyor.yml @@ -0,0 +1,77 @@ +version: 1.0.{build} + +image: Visual Studio 2019 + +environment: + JAVA_HOME: C:\Program Files\Java\jdk1.8.0 + THIRDPARTY_HOME: $(APPVEYOR_BUILD_FOLDER)\thirdparty + SNAPPY_HOME: $(THIRDPARTY_HOME)\snappy-1.1.7 + SNAPPY_INCLUDE: $(SNAPPY_HOME);$(SNAPPY_HOME)\build + SNAPPY_LIB_DEBUG: $(SNAPPY_HOME)\build\Debug\snappy.lib + SNAPPY_LIB_RELEASE: $(SNAPPY_HOME)\build\Release\snappy.lib + LZ4_HOME: $(THIRDPARTY_HOME)\lz4-1.8.3 + LZ4_INCLUDE: $(LZ4_HOME)\lib + LZ4_LIB_DEBUG: $(LZ4_HOME)\visual\VS2010\bin\x64_Debug\liblz4_static.lib + LZ4_LIB_RELEASE: $(LZ4_HOME)\visual\VS2010\bin\x64_Release\liblz4_static.lib + ZSTD_HOME: $(THIRDPARTY_HOME)\zstd-1.4.0 + ZSTD_INCLUDE: $(ZSTD_HOME)\lib;$(ZSTD_HOME)\lib\dictBuilder + ZSTD_LIB_DEBUG: $(ZSTD_HOME)\build\VS2010\bin\x64_Debug\libzstd_static.lib + ZSTD_LIB_RELEASE: $(ZSTD_HOME)\build\VS2010\bin\x64_Release\libzstd_static.lib + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: Visual Studio 14 Win64 + DEV_ENV: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: Visual Studio 15 Win64 + DEV_ENV: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.com + +install: + - md %THIRDPARTY_HOME% + - echo "Building Snappy dependency..." + - cd %THIRDPARTY_HOME% + - curl --fail --silent --show-error --output snappy-1.1.7.zip --location https://github.com/google/snappy/archive/1.1.7.zip + - unzip snappy-1.1.7.zip + - cd snappy-1.1.7 + - mkdir build + - cd build + - if DEFINED CMAKE_PLATEFORM_NAME (set "PLATEFORM_OPT=-A %CMAKE_PLATEFORM_NAME%") + - cmake .. -G "%CMAKE_GENERATOR%" %PLATEFORM_OPT% + - msbuild Snappy.sln /p:Configuration=Debug /p:Platform=x64 + - msbuild Snappy.sln /p:Configuration=Release /p:Platform=x64 + - echo "Building LZ4 dependency..." + - cd %THIRDPARTY_HOME% + - curl --fail --silent --show-error --output lz4-1.8.3.zip --location https://github.com/lz4/lz4/archive/v1.8.3.zip + - unzip lz4-1.8.3.zip + - cd lz4-1.8.3\visual\VS2010 + - ps: $CMD="$Env:DEV_ENV"; & $CMD lz4.sln /upgrade + - msbuild lz4.sln /p:Configuration=Debug /p:Platform=x64 + - msbuild lz4.sln /p:Configuration=Release /p:Platform=x64 + - echo "Building ZStd dependency..." + - cd %THIRDPARTY_HOME% + - curl --fail --silent --show-error --output zstd-1.4.0.zip --location https://github.com/facebook/zstd/archive/v1.4.0.zip + - unzip zstd-1.4.0.zip + - cd zstd-1.4.0\build\VS2010 + - ps: $CMD="$Env:DEV_ENV"; & $CMD zstd.sln /upgrade + - msbuild zstd.sln /p:Configuration=Debug /p:Platform=x64 + - msbuild zstd.sln /p:Configuration=Release /p:Platform=x64 + +before_build: + - md %APPVEYOR_BUILD_FOLDER%\build + - cd %APPVEYOR_BUILD_FOLDER%\build + - if DEFINED CMAKE_PLATEFORM_NAME (set "PLATEFORM_OPT=-A %CMAKE_PLATEFORM_NAME%") + - cmake .. -G "%CMAKE_GENERATOR%" %PLATEFORM_OPT% %CMAKE_OPT% -DCMAKE_BUILD_TYPE=Debug -DOPTDBG=1 -DPORTABLE=1 -DSNAPPY=1 -DLZ4=1 -DZSTD=1 -DXPRESS=1 -DJNI=1 -DWITH_ALL_TESTS=0 + - cd .. + +build: + project: build\rocksdb.sln + parallel: true + verbosity: normal + +test: + +test_script: + - ps: build_tools\run_ci_db_test.ps1 -SuiteRun db_basic_test,env_basic_test -Concurrency 8 + +on_failure: + - cmd: 7z a build-failed.zip %APPVEYOR_BUILD_FOLDER%\build\ && appveyor PushArtifact build-failed.zip + diff --git a/storage/rocksdb/rocksdb/defs.bzl b/storage/rocksdb/rocksdb/defs.bzl new file mode 100644 index 000000000..679937c3a --- /dev/null +++ b/storage/rocksdb/rocksdb/defs.bzl @@ -0,0 +1,56 @@ +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +# +# defs.bzl - Definitions for Facebook-specific buck build integration +# in TARGETS + +load("@fbcode_macros//build_defs:coverage.bzl", "coverage") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") + +def test_binary( + test_name, + test_cc, + parallelism, + rocksdb_arch_preprocessor_flags, + rocksdb_os_preprocessor_flags, + rocksdb_compiler_flags, + rocksdb_preprocessor_flags, + rocksdb_external_deps, + rocksdb_os_deps, + extra_deps, + extra_compiler_flags): + TEST_RUNNER = native.package_name() + "/buckifier/rocks_test_runner.sh" + + ttype = "gtest" if parallelism == "parallel" else "simple" + test_bin = test_name + "_bin" + + cpp_binary( + name = test_bin, + srcs = [test_cc], + arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, + os_preprocessor_flags = rocksdb_os_preprocessor_flags, + compiler_flags = rocksdb_compiler_flags + extra_compiler_flags, + preprocessor_flags = rocksdb_preprocessor_flags, + deps = [":rocksdb_test_lib"] + extra_deps, + os_deps = rocksdb_os_deps, + external_deps = rocksdb_external_deps, + ) + + binary_path = "$(location :{})".format(test_bin) + + base_path = native.package_name() + tags = [] + if coverage.is_coverage_enabled(base_path): + # This tag instructs testpilot to use + # the lower-memory coverage runner + # (e.g. it tells testpilot that the binary + # is actually instrumented with coverage info) + tags = ["coverage"] + + custom_unittest( + name = test_name, + command = [TEST_RUNNER, binary_path], + type = ttype, + env = {"BUCK_BASE_BINARY": binary_path}, + tags = tags, + ) -- Gitee