Line data Source code
1 : // Smoke tests for the link-time-stamped engine version constants.
2 : //
3 : // Hermetic by design: the assertions only check that the symbols are
4 : // defined and that the strings are non-empty. We do NOT assert the
5 : // values themselves because the genrule that emits `version.cc`
6 : // substitutes in environment variables at build time (see
7 : // `binaries/emulator_main/BUILD.bazel`'s `:version_cc` rule), and the
8 : // test must pass for both stamped (`bazel build --action_env=...`)
9 : // and unstamped (`bazel build` default `dev/none/unknown`) builds.
10 : //
11 : // The integration check that a stamped build actually shows the
12 : // stamped values is performed by the `--version` invocation in plan
13 : // 45's verification block (`./bin/emulator_main --version` after
14 : // `task emulator:build-engine:bazel`).
15 :
16 : #include "binaries/emulator_main/version.h"
17 :
18 : #include <cstring>
19 :
20 : #include "gtest/gtest.h"
21 :
22 : namespace bigquery_emulator::binaries::emulator_main {
23 : namespace {
24 :
25 1 : TEST(VersionTest, SymbolsAreDefined) {
26 1 : ASSERT_NE(kVersion, nullptr);
27 1 : ASSERT_NE(kCommit, nullptr);
28 1 : ASSERT_NE(kBuildDate, nullptr);
29 1 : }
30 :
31 1 : TEST(VersionTest, SymbolsAreNonEmpty) {
32 1 : EXPECT_GT(std::strlen(kVersion), 0u);
33 1 : EXPECT_GT(std::strlen(kCommit), 0u);
34 1 : EXPECT_GT(std::strlen(kBuildDate), 0u);
35 1 : }
36 :
37 : } // namespace
38 : } // namespace bigquery_emulator::binaries::emulator_main
|