Skip to content

Commit 6e8f112

Browse files
authored
starboard/nplb: Fold nplb_evergreen_compat_tests into nplb proper (youtube#4946)
This is a follow-up to youtube#4831, rolling `nplb_evergreen_compat_tests` into `nplb` proper. Run via `./out/linux-x64x11_devel/nplb --gtest_filter=*CrashpadConfigTest*:*SabiTest*:*ExecutableMemoryTest*:*MaxFileNameTest*:*StorageTest*:*LoaderAppMetricsTest:*FontsTest*` -- Two sets of test failed on my Linux and needed attention: - `CrashpadConfigTest.VerifyUploadCert` was IIUC broken due to an extra `...app/cobalt/content...` path manually added to the cert location. Looking at the GN `ssl:copy_ssl_certificates` target, it seems to agree with `GetCACertificatesPath()` in that the extra path is not needed. Discussing this with @y4vor, we decided to add a new helper target `copy_ssl_certificates_evergreen` to put the certs in the right spot. - `FontsTest.*` needed `deps` on `fonts:copy_font_data` GN targets (both `data_deps` and `deps`). This worked, but I had to comment out the `install_content = true` statements in that BUILD.gn (it's unclear whether this would break other things). Said GN target uses `exec_script` and needs an exception in //.gn, this CL adds that too. Asides from it, some unnecessary test classes are removed, and some preprocessor logic simplified. Bug: b/384819454
1 parent a3ac2ff commit 6e8f112

13 files changed

Lines changed: 63 additions & 98 deletions

File tree

‎.gn‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ exec_script_whitelist += [
173173
"//starboard/tools/BUILD.gn",
174174
"//starboard/build/config/sabi/BUILD.gn",
175175
"//starboard/build/platform_path.gni",
176+
"//starboard/content/fonts/BUILD.gn",
176177
]
177178

178179
# TODO(cobalt, b/377295011): figure out a better long-term solution here, or

‎starboard/content/fonts/BUILD.gn‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ if (cobalt_font_package == "empty") {
2323
}
2424
} else {
2525
action("fonts_xml") {
26-
install_content = true
2726
script = "scripts/filter_fonts.py"
2827
font_xml = "$source_font_config_dir/fonts.xml"
2928
sources = [ font_xml ]
@@ -37,7 +36,6 @@ if (cobalt_font_package == "empty") {
3736
}
3837

3938
copy("copy_fonts") {
40-
install_content = true
4139
if (copy_font_files) {
4240
fonts = exec_script("scripts/filter_fonts.py",
4341
[

‎starboard/content/ssl/BUILD.gn‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
import("//starboard/content/ssl/certs.gni")
1616

1717
copy("copy_ssl_certificates") {
18-
if (enable_install_targets) {
19-
install_content = true
20-
}
2118
sources = network_certs
2219
outputs =
2320
[ "$sb_static_contents_output_data_dir/ssl/certs/{{source_file_part}}" ]
2421
}
22+
23+
copy("copy_ssl_certificates_evergreen") {
24+
sources = network_certs
25+
outputs = [ "$sb_static_contents_output_data_dir/app/cobalt/content/ssl/certs/{{source_file_part}}" ]
26+
}

‎starboard/doc/evergreen/cobalt_evergreen_overview.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,10 @@ For example, building these targets for the Raspberry Pi 2 would use the
288288

289289
## Verifying Platform Requirements
290290

291-
In order to verify the platform requirements you should run the
292-
`nplb_evergreen_compat_tests`. These tests ensure that the platform is
293-
configured appropriately for Evergreen.
291+
NPLB tests in general verify platform requirements and the subset of tests under
292+
`nplb_evergreen_compat_tests/` verifies Evergreen-specific platform
293+
requirements. These tests ensure that the platform is configured appropriately
294+
for Evergreen.
294295

295296
To enable the test, set the `sb_is_evergreen_compatible` GN variable to `true`
296297
in the platform's `configuration.gni`. For more details please take a look at

‎starboard/nplb/BUILD.gn‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,22 @@ test("nplb") {
312312
"//starboard/shared/starboard/player:video_dmp",
313313
]
314314
}
315+
316+
if (sb_is_evergreen_compatible) {
317+
sources += [
318+
"nplb_evergreen_compat_tests/checks.h",
319+
"nplb_evergreen_compat_tests/crashpad_config_test.cc",
320+
"nplb_evergreen_compat_tests/executable_memory_test.cc",
321+
"nplb_evergreen_compat_tests/fonts_test.cc",
322+
"nplb_evergreen_compat_tests/loader_app_metrics_test.cc",
323+
"nplb_evergreen_compat_tests/max_file_name_test.cc",
324+
"nplb_evergreen_compat_tests/sabi_test.cc",
325+
"nplb_evergreen_compat_tests/storage_test.cc",
326+
]
327+
data_deps += [
328+
"//starboard/content/fonts:copy_font_data",
329+
"//starboard/content/ssl:copy_ssl_certificates_evergreen",
330+
]
331+
deps += [ "//starboard/content/fonts:copy_font_data" ]
332+
}
315333
}

‎starboard/nplb/nplb_evergreen_compat_tests/BUILD.gn‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎starboard/nplb/nplb_evergreen_compat_tests/crashpad_config_test.cc‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,38 @@
2323
#include "starboard/system.h"
2424
#include "testing/gtest/include/gtest/gtest.h"
2525

26-
#if SB_IS(EVERGREEN_COMPATIBLE)
26+
#if !SB_IS(EVERGREEN_COMPATIBLE)
27+
#error These tests apply only to EVERGREEN_COMPATIBLE platforms.
28+
#endif
2729

2830
namespace starboard {
2931
namespace nplb {
3032
namespace nplb_evergreen_compat_tests {
3133

3234
namespace {
3335

34-
class CrashpadConfigTest : public ::testing::Test {
35-
protected:
36-
CrashpadConfigTest() {}
37-
~CrashpadConfigTest() {}
38-
};
39-
4036
// These tests are not applicable to AOSP
4137
#if !defined(ANDROID)
4238

43-
TEST_F(CrashpadConfigTest, VerifyUploadCert) {
39+
TEST(CrashpadConfigTest, VerifyUploadCert) {
4440
std::vector<char> buffer(kSbFileMaxPath);
4541
ASSERT_TRUE(SbSystemGetPath(kSbSystemPathContentDirectory, buffer.data(),
4642
buffer.size()));
43+
ASSERT_LE(kSbFileMaxPath, buffer.size());
4744

4845
std::string cert_location(buffer.data());
4946
cert_location.append(std::string(kSbFileSepString) + "app" +
5047
kSbFileSepString + "cobalt" + kSbFileSepString +
5148
"content" + kSbFileSepString + "ssl" + kSbFileSepString +
5249
"certs");
50+
5351
struct stat info;
54-
ASSERT_TRUE(stat(cert_location.c_str(), &info) == 0);
52+
ASSERT_TRUE(stat(cert_location.c_str(), &info) == 0) << cert_location;
5553
}
5654

5755
#endif // !defined(ANDROID)
5856

59-
TEST_F(CrashpadConfigTest, VerifyCrashHandlerExtension) {
57+
TEST(CrashpadConfigTest, VerifyCrashHandlerExtension) {
6058
auto crash_handler_extension =
6159
SbSystemGetExtension(kCobaltExtensionCrashHandlerName);
6260
ASSERT_TRUE(crash_handler_extension != nullptr);
@@ -66,5 +64,3 @@ TEST_F(CrashpadConfigTest, VerifyCrashHandlerExtension) {
6664
} // namespace nplb_evergreen_compat_tests
6765
} // namespace nplb
6866
} // namespace starboard
69-
70-
#endif // SB_IS(EVERGREEN_COMPATIBLE)

‎starboard/nplb/nplb_evergreen_compat_tests/executable_memory_test.cc‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
#include <sys/mman.h>
1616

17+
#include "starboard/common/log.h"
1718
#include "starboard/configuration_constants.h"
1819
#include "starboard/nplb/nplb_evergreen_compat_tests/checks.h"
1920
#include "testing/gtest/include/gtest/gtest.h"
2021

21-
#if SB_IS(EVERGREEN_COMPATIBLE)
22+
#if !SB_IS(EVERGREEN_COMPATIBLE)
23+
#error These tests apply only to EVERGREEN_COMPATIBLE platforms.
24+
#endif
2225

2326
namespace starboard {
2427
namespace nplb {
@@ -52,5 +55,3 @@ TEST_F(ExecutableMemoryTest, VerifyMemoryProtection) {
5255
} // namespace nplb_evergreen_compat_tests
5356
} // namespace nplb
5457
} // namespace starboard
55-
56-
#endif // SB_IS(EVERGREEN_COMPATIBLE)

‎starboard/nplb/nplb_evergreen_compat_tests/fonts_test.cc‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
#include "starboard/common/log.h"
2121
#include "starboard/configuration.h"
2222
#include "starboard/configuration_constants.h"
23-
#include "starboard/nplb/nplb_evergreen_compat_tests/checks.h"
2423
#include "starboard/system.h"
2524
#include "testing/gtest/include/gtest/gtest.h"
2625

27-
// These tests are not applicable to AOSP
28-
#if SB_IS(EVERGREEN_COMPATIBLE) && !defined(ANDROID)
26+
#if !SB_IS(EVERGREEN_COMPATIBLE)
27+
#error These tests apply only to EVERGREEN_COMPATIBLE platforms.
28+
#endif
29+
30+
#if defined(ANDROID)
31+
#error These tests are not applicable to AOSP
32+
#endif
2933

3034
namespace starboard {
3135
namespace nplb {
@@ -63,5 +67,3 @@ TEST(FontsTest, VerifySystemFontsConfigDirectory) {
6367
} // namespace nplb_evergreen_compat_tests
6468
} // namespace nplb
6569
} // namespace starboard
66-
67-
#endif // SB_IS(EVERGREEN_COMPATIBLE) && !defined(ANDROID)

‎starboard/nplb/nplb_evergreen_compat_tests/loader_app_metrics_test.cc‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@
1717
#include "starboard/system.h"
1818
#include "testing/gtest/include/gtest/gtest.h"
1919

20-
#if SB_IS(EVERGREEN_COMPATIBLE)
20+
#if !SB_IS(EVERGREEN_COMPATIBLE)
21+
#error These tests apply only to EVERGREEN_COMPATIBLE platforms.
22+
#endif
2123

2224
namespace starboard {
2325
namespace nplb {
2426
namespace nplb_evergreen_compat_tests {
2527

2628
namespace {
2729

28-
class LoaderAppMetricsTest : public ::testing::Test {
29-
protected:
30-
LoaderAppMetricsTest() {}
31-
~LoaderAppMetricsTest() {}
32-
};
33-
34-
TEST_F(LoaderAppMetricsTest, VerifyLoaderAppMetricsExtension) {
30+
TEST(LoaderAppMetricsTest, VerifyLoaderAppMetricsExtension) {
3531
auto extension = static_cast<const StarboardExtensionLoaderAppMetricsApi*>(
3632
SbSystemGetExtension(kStarboardExtensionLoaderAppMetricsName));
3733

@@ -51,5 +47,3 @@ TEST_F(LoaderAppMetricsTest, VerifyLoaderAppMetricsExtension) {
5147
} // namespace nplb_evergreen_compat_tests
5248
} // namespace nplb
5349
} // namespace starboard
54-
55-
#endif // SB_IS(EVERGREEN_COMPATIBLE)

0 commit comments

Comments
 (0)