Skip to content

Commit

Permalink
Build nplb test (#4299)
Browse files Browse the repository at this point in the history
Note that Starboard initialization still needs to happen for this test to be able to run, right now it crashes immediately.

b/371606611
  • Loading branch information
andrewsavage1 authored Oct 30, 2024
1 parent fbe3fb9 commit 9cea165
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 38 deletions.
5 changes: 4 additions & 1 deletion cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ group("gn_all") {
testonly = true

# TODO(b/371589344): Fix android build configs.
deps = [ "//starboard($starboard_toolchain)" ]
deps = [
"//starboard($starboard_toolchain)",
"//starboard/nplb",
]
if (!is_android) {
deps += [ ":cobalt" ]
} else {
Expand Down
1 change: 1 addition & 0 deletions cobalt/docker/linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN apt-get update && apt-get install -y \
libpango-1.0-0 \
gcc-multilib \
bzip2 \
python3-certifi \
&& rm -rf /var/lib/apt/lists/*

ADD files/sccache /usr/local/bin
Expand Down
4 changes: 3 additions & 1 deletion starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("//starboard/build/config/os_definitions.gni")
import("//starboard/build/config/starboard_target_type.gni")
import("//starboard/contrib/cast/cast.gni")

if (sb_is_modular) {
if (!is_cobalt) {
group("gn_all") {
testonly = true

Expand Down Expand Up @@ -225,6 +225,8 @@ source_set("starboard_headers_only") {
# TODO: b/374302273 - Fix starboard implementation to not emit these compiler warnings.
config("hacky_wnos") {
cflags = [
"-Wno-undefined-internal",

# Disable errors for the warning till the Android NDK r19 is fixed.
# The warning is trigger when compiling .c files and complains for
# "-stdlib=libc++" which is added by the NDK.
Expand Down
1 change: 0 additions & 1 deletion starboard/android/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ static_library("starboard_platform") {
"log_internal.cc",
"log_internal.h",
"log_raw.cc",
"main.cc",
"max_media_codec_output_buffers_lookup_table.cc",
"max_media_codec_output_buffers_lookup_table.h",
"media_capabilities_cache.cc",
Expand Down
7 changes: 7 additions & 0 deletions starboard/android/shared/platform_configuration/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ config("platform_configuration") {
"log",
"mediandk",
]
cflags = [
"-fsigned-char",

# Ignore warnings in Chromium code related to forcing signed char.
"-Wno-sign-compare",
"-Wno-c++11-narrowing",
]
}

config("size") {
Expand Down
1 change: 1 addition & 0 deletions starboard/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static_library("file_wrapper") {
"file_wrapper.cc",
"file_wrapper.h",
]
deps = [ "//starboard:starboard_headers_only" ]
}

target(gtest_target_type, "common_test") {
Expand Down
16 changes: 11 additions & 5 deletions starboard/common/test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "starboard/configuration.h"
#include "testing/gtest/include/gtest/gtest.h"

#if SB_IS(EVERGREEN)
#include "starboard/client_porting/wrap_main/wrap_main.h"
#include "starboard/event.h"
#include "starboard/system.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {
int InitAndRunAllTests(int argc, char** argv) {
Expand All @@ -26,7 +29,10 @@ int InitAndRunAllTests(int argc, char** argv) {

// When we are building Evergreen we need to export SbEventHandle so that the
// ELF loader can find and invoke it.
#if SB_IS(MODULAR)
SB_EXPORT
#endif // SB_IS(MODULAR)
STARBOARD_WRAP_SIMPLE_MAIN(InitAndRunAllTests);
SB_EXPORT STARBOARD_WRAP_SIMPLE_MAIN(InitAndRunAllTests);
#else
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#endif
4 changes: 1 addition & 3 deletions starboard/linux/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ static_library("starboard_platform_sources") {
"//starboard/shared/starboard/file_storage/storage_read_record.cc",
"//starboard/shared/starboard/log_mutex.cc",
"//starboard/shared/starboard/log_mutex.h",
"//starboard/shared/starboard/log_raw_dump_stack.cc",
"//starboard/shared/starboard/log_raw_format.cc",
"//starboard/shared/starboard/media/media_can_play_mime_and_key_system.cc",
"//starboard/shared/starboard/media/media_get_audio_buffer_budget.cc",
Expand Down Expand Up @@ -269,9 +270,6 @@ static_library("starboard_platform_sources") {
"//starboard/shared/stub/thread_create_priority.cc",
"//starboard/shared/stub/window_get_diagonal_size_in_inches.cc",
]
if (enable_evergreen_code) {
sources += [ "//starboard/shared/starboard/log_raw_dump_stack.cc" ]
}

sources += common_player_sources

Expand Down
64 changes: 41 additions & 23 deletions starboard/nplb/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import("//starboard/build/config/os_definitions.gni")
import("//testing/test.gni")

declare_args() {
sb_enable_cast_codec_tests = false
Expand All @@ -22,7 +23,18 @@ config("cast_codec_tests") {
cflags = [ "ENABLE_CAST_CODEC_TESTS" ]
}

target(gtest_target_type, "nplb") {
config("wnos") {
cflags = [
"-Wno-ignored-qualifiers",
"-Wno-self-assign-overloaded",
"-Wno-pessimizing-move",
"-Wno-unused-local-typedef",
"-Wno-unreachable-code",
"-Wno-unreachable-code-break",
]
}

test("nplb") {
testonly = true

sources = [
Expand All @@ -35,11 +47,7 @@ target(gtest_target_type, "nplb") {
"//starboard/nplb/sabi/struct_alignment_test.cc",
"//starboard/shared/starboard/drm/drm_test_helpers.cc",
"//starboard/shared/starboard/drm/drm_test_helpers.h",
"//starboard/testing/fake_graphics_context_provider.cc",
"//starboard/testing/fake_graphics_context_provider.h",
"align_test.cc",
"atomic_base_test.cc",
"atomic_test.cc",
"audio_sink_create_test.cc",
"audio_sink_destroy_test.cc",
"audio_sink_get_max_channels_test.cc",
Expand Down Expand Up @@ -79,32 +87,23 @@ target(gtest_target_type, "nplb") {
"drm_create_system_test.cc",
"maximum_player_configuration_explorer.cc",
"maximum_player_configuration_explorer.h",
"maximum_player_configuration_explorer_test.cc",
"media_buffer_test.cc",
"media_can_play_mime_and_key_system_test.cc",
"media_configuration_test.cc",
"media_set_audio_write_duration_test.cc",
"microphone_close_test.cc",
"microphone_create_test.cc",
"microphone_destroy_test.cc",
"microphone_get_available_test.cc",
"microphone_is_sample_rate_supported_test.cc",
"microphone_open_test.cc",
"microphone_read_test.cc",
"multiple_player_test.cc",
"murmurhash2_test.cc",
"optional_test.cc",
"player_create_test.cc",
"player_creation_param_helpers.cc",
"player_creation_param_helpers.h",
"player_get_audio_configuration_test.cc",
"player_get_media_time_test.cc",
"player_get_preferred_output_mode_test.cc",
"player_test_fixture.cc",
"player_test_fixture.h",
"player_test_util.cc",
"player_test_util.h",
"player_write_sample_test.cc",
"posix_compliance/posix_arpa_inet_test.cc",
"posix_compliance/posix_condition_variable_broadcast_test.cc",
"posix_compliance/posix_condition_variable_create_test.cc",
Expand Down Expand Up @@ -185,7 +184,6 @@ target(gtest_target_type, "nplb") {
"socket_waiter_destroy_test.cc",
"socket_waiter_wake_up_test.cc",
"socket_wrapper_test.cc",
"speech_synthesis_basic_test.cc",
"storage_close_record_test.cc",
"storage_get_record_size_test.cc",
"storage_read_record_test.cc",
Expand Down Expand Up @@ -220,15 +218,35 @@ target(gtest_target_type, "nplb") {
"ui_navigation_test.cc",
"undefined_behavior_test.cc",
"url_player_create_test.cc",
"vertical_video_test.cc",
"window_create_test.cc",
"window_destroy_test.cc",
"window_get_diagonal_size_in_inches_test.cc",
"window_get_platform_handle_test.cc",
"window_get_size_test.cc",
]

configs += [ "//starboard/build/config:starboard_implementation" ]
if (!is_android) {
sources += [
"//starboard/testing/fake_graphics_context_provider.cc",
"//starboard/testing/fake_graphics_context_provider.h",
"maximum_player_configuration_explorer_test.cc",
"media_set_audio_write_duration_test.cc",
"multiple_player_test.cc",
"player_create_test.cc",
"player_get_audio_configuration_test.cc",
"player_get_media_time_test.cc",
"player_test_fixture.cc",
"player_test_fixture.h",
"player_write_sample_test.cc",
"speech_synthesis_basic_test.cc",
"vertical_video_test.cc",
"window_create_test.cc",
"window_destroy_test.cc",
"window_get_diagonal_size_in_inches_test.cc",
"window_get_platform_handle_test.cc",
"window_get_size_test.cc",
]
}

configs += [
"//starboard/build/config:starboard_implementation",
":wnos",
]
if (sb_enable_cast_codec_tests) {
configs += [ ":cast_codec_tests" ]
}
Expand Down Expand Up @@ -264,7 +282,7 @@ target(gtest_target_type, "nplb") {
"//starboard/shared/starboard/player:player_download_test_data",
]

if (is_clang && !is_android) {
if (is_clang) {
# signedness_and_size_of_enum_test.cc casts -1 to enum value
cflags = [ "-Wno-enum-constexpr-conversion" ]
}
Expand Down
21 changes: 20 additions & 1 deletion starboard/nplb/compiler_compliance/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.

config("no_unused") {
cflags = [
"-Wno-unused-variable",
"-Wno-unused-function",
"-Wno-unused-const-variable",
"-Wno-unreachable-code-break",
]
}

static_library("cpp14_supported") {
sources = [
"cpp14_constexpr.cc",
"cpp14_initialization.cc",
]
configs += [
":no_unused",
"//starboard/build/config:starboard",
"//starboard/build/config/sabi",
]
cflags_cc = [ "-std=c++14" ]
deps = [ "//starboard:starboard_group" ]
}

if (sb_enable_cpp17_audit) {
static_library("cpp17_supported") {
sources = [ "cpp17_support.cc" ]
configs += [
"//starboard/build/config:starboard",
"//starboard/build/config/sabi",
":no_unused",
]
deps = [
":cpp17_supported_config_shim",
"//starboard:starboard_group",
Expand All @@ -44,11 +63,11 @@ if (sb_enable_cpp17_audit) {
if (sb_enable_cpp20_audit) {
static_library("cpp20_supported") {
sources = [ "cpp20_support.cc" ]
configs += [ ":no_unused" ]
deps = [
":cpp20_supported_config_shim",
"//starboard:starboard_group",
]
configs -= [ "//starboard/build/config:default_cpp_standard" ]
}

# We do this to ensure the -std=c++20 flag is added after any other -std flag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <string>
#include <vector>

#include "starboard/common/string.h"
#include "starboard/nplb/drm_helpers.h"
#include "starboard/nplb/maximum_player_configuration_explorer.h"
#include "starboard/nplb/player_test_util.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <string>

#include "starboard/common/string.h"
#include "starboard/configuration_constants.h"
#include "starboard/nplb/file_helpers.h"
#include "starboard/system.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <string>

#include "starboard/common/log.h"
#include "starboard/common/string.h"
#include "starboard/configuration.h"
#include "starboard/configuration_constants.h"
#include "starboard/nplb/file_helpers.h"
Expand Down
1 change: 1 addition & 0 deletions starboard/nplb/posix_compliance/posix_socket_bind_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Here we are not trying to do anything fancy, just to really sanity check that
// this is hooked up to something.

#include "starboard/common/string.h"
#include "starboard/nplb/posix_compliance/posix_socket_helpers.h"

namespace starboard {
Expand Down
1 change: 1 addition & 0 deletions starboard/nplb/posix_compliance/posix_socket_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/types.h>
#include <unistd.h>

#include "starboard/common/log.h"
#include "starboard/common/time.h"
#include "starboard/nplb/socket_helpers.h"
#include "starboard/socket.h"
Expand Down
1 change: 1 addition & 0 deletions starboard/nplb/posix_compliance/posix_socket_send_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include "starboard/common/log.h"
#include "starboard/nplb/posix_compliance/posix_socket_helpers.h"
#include "starboard/thread.h"

Expand Down
2 changes: 0 additions & 2 deletions starboard/nplb/testdata/file_tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.

copy("nplb_file_tests_data") {
install_content = true

sources = [
"dir_with_files/file11",
"dir_with_files/file12",
Expand Down
1 change: 0 additions & 1 deletion starboard/shared/ffmpeg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,4 @@ target(gtest_target_type, "ffmpeg_demuxer_test") {
"//testing/gmock",
"//testing/gtest",
]
data_deps = [ "//media/test/data:media_testdata" ]
}

0 comments on commit 9cea165

Please sign in to comment.