ci(tests): add test framework (#1603)

This commit is contained in:
ReenigneArcher
2024-03-24 19:52:24 -04:00
committed by GitHub
parent 934f81182a
commit 89e8b9628c
43 changed files with 1519 additions and 136 deletions

View File

@@ -31,13 +31,19 @@ post-fetch {
system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive"
}
# https://guide.macports.org/chunked/reference.dependencies.html
depends_build-append port:npm9 \
port:pkgconfig
depends_lib port:avahi \
port:curl \
port:libopus \
port:miniupnpc
port:miniupnpc \
port:python311 \
port:py311-pip
depends_test port:doxygen \
port:graphviz
boost.version 1.81
@@ -62,3 +68,9 @@ notes-append "Run @PROJECT_NAME@ by executing 'sunshine <path to user config>',
notes-append "The config file will be created if it doesn't exist."
notes-append "It is recommended to set a location for the apps file in the config."
notes-append "See our documentation at 'https://docs.lizardbyte.dev/projects/sunshine/en/v@PROJECT_VERSION@/' for further info."
test.run yes
test.dir ${build.dir}/tests
test.target ""
test.cmd ./test_sunshine
test.args --gtest_color=yes

View File

@@ -11,26 +11,28 @@ class @PROJECT_NAME@ < Formula
depends_on "boost" => :build
depends_on "cmake" => :build
depends_on "node" => :build
depends_on "pkg-config" => :build
depends_on "curl"
depends_on "miniupnpc"
depends_on "node"
depends_on "openssl"
depends_on "opus"
def install
args = %W[
-DBUIld_WERROR=ON
-DBUILD_WERROR=ON
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix}
-DSUNSHINE_ASSETS_DIR=sunshine/assets
-DSUNSHINE_BUILD_HOMEBREW=ON
-DTESTS_ENABLE_PYTHON_TESTS=OFF
]
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
cd "build" do
system "make", "-j"
system "make", "install"
bin.install "tests/test_sunshine"
end
end
@@ -54,9 +56,10 @@ class @PROJECT_NAME@ < Formula
test do
# test that the binary runs at all
output = shell_output("#{bin}/sunshine --version").strip
puts output
system "#{bin}/sunshine", "--version"
# TODO: add unit tests
# run the test suite
# cannot build tests with python tests because homebrew destroys the source directory
system "#{bin}/test_sunshine", "--gtest_color=yes"
end
end