Skip to content

Commit

Permalink
Switch to the the CMake-ified Seastar
Browse files Browse the repository at this point in the history
Committer: Avi Kivity <[email protected]>
Branch: next

Switch to the the CMake-ified Seastar

This change allows Scylla to be compiled against the `master` branch of
Seastar.

The necessary changes:

- Add `-Wno-error` to prevent a Seastar warning from terminating the
  build

- The new Seastar build system generates the pkg-config files (for
  example, `seastar.pc`) at configure time, so we don't need to invoke
  Ninja to generate them

- The `-march` argument is no longer inherited from Seastar (correctly),
  so it needs to be provided independently

- Define `SEASTAR_TESTING_MAIN` so that the definition of an entry
  point is included for all unit test compilation units

- Independently link Scylla against Seastar's compiled copy of fmt in
  its build directory

- All test files use the (now public) Seastar testing headers

- Add some missing Seastar headers to source files

[avi: regenerate frozen toolchain, adjust seastar submoule]
Signed-off-by: Jesse Haber-Kucharsky <[email protected]>
Message-Id: <02141f2e1ecff5cbcd56b32768356c3bf62750c4.1548820547.git.jhaberku@scylladb.com>
  • Loading branch information
Jesse Haber-Kucharsky authored and avikivity committed Jan 30, 2019
1 parent 9dd3c59 commit b39eac6
Show file tree
Hide file tree
Showing 73 changed files with 112 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "seastar"]
path = seastar
url = ../scylla-seastar
url = ../seastar
ignore = dirty
[submodule "swagger-ui"]
path = swagger-ui
Expand Down
61 changes: 25 additions & 36 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,11 +775,6 @@ def endswith(self, end):
'tests/mutation_source_test.cc',
]

scylla_tests_seastar_deps = [
'seastar/tests/test-utils.cc',
'seastar/tests/test_runner.cc',
]

deps = {
'scylla': idls + ['main.cc', 'release.cc'] + scylla_core + api,
}
Expand Down Expand Up @@ -848,7 +843,6 @@ def endswith(self, end):
deps[t] = [t + '.cc']
if t not in tests_not_using_seastar_test_framework:
deps[t] += scylla_tests_dependencies
deps[t] += scylla_tests_seastar_deps
else:
deps[t] += scylla_core + idls + ['tests/cql_test_env.cc']

Expand Down Expand Up @@ -880,6 +874,8 @@ def endswith(self, end):
deps['utils/gz/gen_crc_combine_table'] = ['utils/gz/gen_crc_combine_table.cc']

warnings = [
'-Wall',
'-Werror',
'-Wno-mismatched-tags', # clang-only
'-Wno-maybe-uninitialized', # false positives on gcc 5
'-Wno-tautological-compare',
Expand All @@ -893,7 +889,11 @@ def endswith(self, end):
'-Wno-misleading-indentation',
'-Wno-overflow',
'-Wno-noexcept-type',
'-Wno-nonnull-compare'
'-Wno-nonnull-compare',
'-Wno-error=cpp',
'-Wno-ignored-attributes',
'-Wno-overloaded-virtual',
'-Wno-stringop-overflow',
]

warnings = [w
Expand Down Expand Up @@ -1019,21 +1019,15 @@ def setup_first_pkg_of_list(pkglist):
if args.dpdk:
# fake dependencies on dpdk, so that it is built before anything else
seastar_flags += ['--enable-dpdk']
elif args.dpdk_target:
seastar_flags += ['--dpdk-target', args.dpdk_target]
if args.staticcxx:
seastar_flags += ['--static-stdc++']
if args.staticboost:
seastar_flags += ['--static-boost']
if args.staticyamlcpp:
seastar_flags += ['--static-yaml-cpp']
if args.gcc6_concepts:
seastar_flags += ['--enable-gcc6-concepts']
if args.alloc_failure_injector:
seastar_flags += ['--enable-alloc-failure-injector']

args.user_cflags += ' ' + debug_compress_flag(compiler=args.cxx)
args.user_cflags += ' ' + dbgflag
seastar_cflags = args.user_cflags
seastar_cflags += ' ' + debug_compress_flag(compiler=args.cxx)
seastar_cflags += ' -Wno-error'
if args.target != '':
seastar_cflags += ' -march=' + args.target
seastar_ldflags = args.user_ldflags
Expand All @@ -1054,10 +1048,6 @@ def setup_first_pkg_of_list(pkglist):
if not ninja:
print('Ninja executable (ninja or ninja-build) not found on PATH\n')
sys.exit(1)
status = subprocess.call([ninja] + list(pc.values()), cwd='seastar')
if status:
print('Failed to generate {}\n'.format(pc))
sys.exit(1)

def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
pc_file = os.path.join('seastar', seastar_pc_file)
Expand All @@ -1067,13 +1057,6 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
if link_static_cxx:
libs = libs.replace('-lstdc++ ', '')

# Amend the incorrect flags in the pkg-config file to point to the
# right place. This is a temporary hack until we switch to the new
# pkg-config specification.
cflags = (cflags
.replace('-I. ', '')
.replace('-Iinclude ', '-I' + os.path.join('seastar', 'include') + ' '))

return cflags, libs

for mode in build_modes:
Expand All @@ -1082,6 +1065,7 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
modes[mode]['seastar_libs'] = seastar_libs

args.user_cflags += " " + pkg_config('jsoncpp', '--cflags')
args.user_cflags += ' -march=' + args.target
libs = ' '.join([maybe_static(args.staticyamlcpp, '-lyaml-cpp'), '-latomic', '-llz4', '-lz', '-lsnappy', pkg_config('jsoncpp', '--libs'),
maybe_static(args.staticboost, '-lboost_filesystem'), ' -lstdc++fs', ' -lcrypt', ' -lcryptopp',
maybe_static(args.staticboost, '-lboost_date_time'), ])
Expand All @@ -1097,8 +1081,8 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
for pkg in pkgs:
args.user_cflags += ' ' + pkg_config(pkg, '--cflags')
libs += ' ' + pkg_config(pkg, '--libs')
user_cflags = args.user_cflags
user_ldflags = args.user_ldflags
user_cflags = args.user_cflags + ' -fvisibility=hidden'
user_ldflags = args.user_ldflags + ' -fvisibility=hidden'
if args.staticcxx:
user_ldflags += " -static-libgcc -static-libstdc++"
if args.staticthrift:
Expand Down Expand Up @@ -1155,14 +1139,16 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
''').format(**globals()))
for mode in build_modes:
modeval = modes[mode]
fmt_lib = 'libfmtd.a' if mode == 'debug' else 'libfmt.a'
f.write(textwrap.dedent('''\
cxxflags_{mode} = {opt} -DXXH_PRIVATE_API -I. -I $builddir/{mode}/gen
cxxflags_{mode} = {opt} -DXXH_PRIVATE_API -DSEASTAR_TESTING_MAIN -I. -I $builddir/{mode}/gen
libs_{mode} = seastar/build/{mode}/_cooking/installed/lib/{fmt_lib}
rule cxx.{mode}
command = $cxx -MD -MT $out -MF $out.d {seastar_cflags} $cxxflags $cxxflags_{mode} $obj_cxxflags -c -o $out $in
command = $cxx -MD -MT $out -MF $out.d {sanitize} {seastar_cflags} $cxxflags $cxxflags_{mode} $obj_cxxflags -c -o $out $in
description = CXX $out
depfile = $out.d
rule link.{mode}
command = $cxx $cxxflags_{mode} {sanitize_libs} $ldflags -o $out $in $libs $libs_{mode} {seastar_libs}
command = $cxx $cxxflags_{mode} {sanitize} {sanitize_libs} $ldflags -o $out $in $libs $libs_{mode} {seastar_libs}
description = LINK $out
pool = link_pool
rule link_stripped.{mode}
Expand All @@ -1188,7 +1174,7 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
s/exceptions::syntax_exception e/exceptions::syntax_exception\& e/' $
build/{mode}/gen/${{stem}}Parser.cpp
description = ANTLR3 $in
''').format(mode=mode, antlr3_exec=antlr3_exec, **modeval))
''').format(mode=mode, antlr3_exec=antlr3_exec, fmt_lib=fmt_lib, **modeval))
f.write(
'build {mode}: phony {artifacts}\n'.format(
mode=mode,
Expand Down Expand Up @@ -1224,8 +1210,11 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
objs.append('$builddir/' + mode + '/gen/utils/gz/crc_combine_table.o')
if binary.startswith('tests/'):
local_libs = '$libs'
if binary not in tests_not_using_seastar_test_framework or binary in pure_boost_tests:
if binary in pure_boost_tests:
local_libs += ' ' + maybe_static(args.staticboost, '-lboost_unit_test_framework')
if binary not in tests_not_using_seastar_test_framework:
pc_path = os.path.join('seastar', pc[mode].replace('seastar.pc', 'seastar-testing.pc'))
local_libs += ' ' + pkg_config(pc_path, '--libs', '--static')
if has_thrift:
local_libs += ' ' + thrift_libs + ' ' + maybe_static(args.staticboost, '-lboost_system')
# Our code's debugging information is huge, and multiplied
Expand Down Expand Up @@ -1307,8 +1296,8 @@ def query_seastar_flags(seastar_pc_file, link_static_cxx=False):
f.write('build seastar/build/{mode}/libseastar.a seastar/build/{mode}/apps/iotune/iotune: ninja | always\n'
.format(**locals()))
f.write(' pool = seastar_pool\n')
f.write(' subdir = seastar\n')
f.write(' target = build/{mode}/libseastar.a build/{mode}/apps/iotune/iotune\n'.format(**locals()))
f.write(' subdir = seastar/build/{mode}\n'.format(**locals()))
f.write(' target = seastar seastar_testing app_iotune\n'.format(**locals()))
f.write(textwrap.dedent('''\
build build/{mode}/iotune: copy seastar/build/{mode}/apps/iotune/iotune
''').format(**locals()))
Expand Down
1 change: 1 addition & 0 deletions gms/inet_address.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include <seastar/core/print.hh>
#include <seastar/net/ip.hh>
#include "utils/serialization.hh"
#include <sstream>
Expand Down
1 change: 1 addition & 0 deletions lister.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <seastar/core/print.hh>
#include <seastar/core/reactor.hh>
#include <seastar/util/log.hh>
#include "lister.hh"
Expand Down
2 changes: 1 addition & 1 deletion seastar
1 change: 1 addition & 0 deletions sstables/integrity_checked_file_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include "integrity_checked_file_impl.hh"
#include <seastar/core/print.hh>
#include <boost/algorithm/cxx11/all_of.hpp>

namespace sstables {
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregate_fcts_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "utils/big_decimal.hh"
#include "exceptions/exceptions.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
2 changes: 1 addition & 1 deletion tests/auth_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <seastar/core/shared_ptr.hh>
#include <seastar/core/thread.hh>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
2 changes: 1 addition & 1 deletion tests/batchlog_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <boost/test/unit_test.hpp>
#include <stdint.h>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
3 changes: 2 additions & 1 deletion tests/broken_sstable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
*/

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include "sstable_test.hh"

using namespace sstables;
Expand Down
2 changes: 1 addition & 1 deletion tests/cache_flat_mutation_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <boost/test/unit_test.hpp>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <seastar/core/thread.hh>
#include "schema_builder.hh"
#include "keys.hh"
Expand Down
2 changes: 1 addition & 1 deletion tests/canonical_mutation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "mutation_assertions.hh"

#include "tests/test_services.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>

#include <seastar/core/thread.hh>

Expand Down
2 changes: 1 addition & 1 deletion tests/castas_fcts_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "utils/big_decimal.hh"
#include "exceptions/exceptions.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
2 changes: 1 addition & 1 deletion tests/cell_locker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
*/

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>

#include <seastar/core/thread.hh>

Expand Down
2 changes: 1 addition & 1 deletion tests/clustering_ranges_walker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


#include <boost/test/unit_test.hpp>
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>

#include "simple_schema.hh"
#include "clustering_ranges_walker.hh"
Expand Down
2 changes: 1 addition & 1 deletion tests/commitlog_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <unordered_set>
#include <set>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <seastar/core/future-util.hh>
#include <seastar/core/do_with.hh>
#include <seastar/core/scollectd_api.hh>
Expand Down
2 changes: 1 addition & 1 deletion tests/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <stdlib.h>
#include <iostream>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <seastar/core/future-util.hh>
#include "db/config.hh"

Expand Down
3 changes: 2 additions & 1 deletion tests/continuous_data_consumer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
#include <seastar/core/iostream.hh>
#include <seastar/core/temporary_buffer.hh>
#include <seastar/core/thread.hh>
#include <seastar/tests/test-utils.hh>
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>
#include <random>

namespace {
Expand Down
2 changes: 1 addition & 1 deletion tests/counter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <boost/range/algorithm/sort.hpp>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/test_services.hh"
#include "schema_builder.hh"
#include "keys.hh"
Expand Down
2 changes: 1 addition & 1 deletion tests/cql_auth_query_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "seastarx.hh"
#include "service/client_state.hh"
#include "tests/cql_test_env.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>

static const auto alice = std::string_view("alice");
static const auto bob = std::string_view("bob");
Expand Down
2 changes: 1 addition & 1 deletion tests/cql_query_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <seastar/net/inet_address.hh>
#include <seastar/core/metrics_api.hh>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
2 changes: 1 addition & 1 deletion tests/data_listeners_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <boost/test/unit_test.hpp>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"
#include "cql3/query_processor.hh"
Expand Down
3 changes: 2 additions & 1 deletion tests/database_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

#include <seastar/core/reactor.hh>
#include <seastar/core/thread.hh>
#include <seastar/tests/test-utils.hh>
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>

#include "tests/cql_test_env.hh"
#include "tests/result_set_assertions.hh"
Expand Down
2 changes: 1 addition & 1 deletion tests/ec2_snitch_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <boost/test/unit_test.hpp>
#include "locator/ec2_snitch.hh"
#include "utils/fb_utilities.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <boost/filesystem.hpp>
#include <vector>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <seastar/core/future-util.hh>
#include <seastar/core/sleep.hh>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
2 changes: 1 addition & 1 deletion tests/filtering_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <seastar/net/inet_address.hh>

#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include "tests/cql_test_env.hh"
#include "tests/cql_assertions.hh"

Expand Down
3 changes: 2 additions & 1 deletion tests/flat_mutation_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@


#include <seastar/core/thread.hh>
#include <seastar/tests/test-utils.hh>
#include <seastar/testing/test_case.hh>
#include <seastar/testing/thread_test_case.hh>

#include "mutation.hh"
#include "mutation_fragment.hh"
Expand Down
3 changes: 2 additions & 1 deletion tests/flush_queue_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
#include <seastar/core/thread.hh>

#include "seastarx.hh"
#include "tests/test-utils.hh"
#include <seastar/testing/test_case.hh>
#include <seastar/core/print.hh>
#include "utils/flush_queue.hh"
#include "log.hh"

Expand Down
Loading

0 comments on commit b39eac6

Please sign in to comment.