Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
WL8400 Provide base repository, testing and tools
Browse files Browse the repository at this point in the history
We store the version of MySQL Router in a special CMake module
named version.cmake in the subfolder cmake/. It both has the
version (as text) and version level.

We add README.md as symbolic link to README.txt. The README.txt
content is updated to use Markdown.

We add external tools and make sure they are loaded when building
MySQL Router. The CMake modules loading the external libraries and
tools are located in the cmake subfolder. Tests are available which
do basic checks whether the tools are loading OK.

The cmake/settings.cmake files contains variables which configure
how building is done. The CMake module is loaded in the root
CMakeLists.txt.

Each sub folder of the src-directory is a MySQL Router module. We load
each module automatically using CMake function add_subdirectory.
Each module is required to have at least a CMakeLists.txt and a
sub-directory called 'include'.
The src/ folder on it's own is loaded by the root CMakeLists.txt.

We add the first module named 'router'. It holds the main application
of MySQL Router and produces the binary 'mysqlrouter'. The name
of the application can be configured in the cmake/settings.cmake
file.

We will use the Boost C++ Libraries and provide a special boost.cmake
file which will discover the Boost headers. If Boost is not available
or does not have the minimum required version, we show a error
message and hint how to fix it. It is possible to provide CMake with
options so Boost is downloaded or point where Boost is installed,
for example:

  shell> cmake .. -DWITH_BOOST=/opt/boost
  shell> cmake .. -DWITH_BOOST=~/myboost \
                   -DDOWNLOAD_BOOST=YES

Tests written in C/C++ and Python are automatically added from
the subdirectories of the tests folder and added . Tests can be run
like this:

  shell> mkdir build
  shell> cd build
  shell> cmake .. -DENABLE_TESTS=YES
  shell> make
  shell> make test

Building of tests is disabled by default. To enable testing,
use the option ENABLE_TESTS:

  shell> cmake .. -DENABLE_TESTS=YES

The README.txt contains further information on how to run tests.

We add a Python unit tests script copyright.py which checks
the copyright notice in all files in the MySQL Router source
repository. Files and folders can be ignored as well as file
extensions. See the class TestCopyright members _ingore_files,
_ignore_folders and _ignore_file_ext.
The location of MySQL Router source can be provided using the
command line --cmake-source-dir or as environment variable
CMAKE_SOURCE_DIR.

To run individual Python test script, do the following:

  shell> PYTHONPATH="." python tests/legal/copyright.py

We test whether the license is mentioned in each relevant file such
as C/C++, Python and CMake files. The FOSS exception and GPL
disclaimer text in the README.txt is also checked.

We test the name of the project in various places such as the
README.txt and cmake/settings.cmake. Additionally, since MySQL
Router is part of MySQL Fabric, we make sure there
is a clause telling so in the README.txt file. The 'partof'-clause is
configurable in cmake/settings.cmake.
  • Loading branch information
Geert Vanderkelen committed May 11, 2015
1 parent 4550907 commit abf32b7
Show file tree
Hide file tree
Showing 25 changed files with 1,520 additions and 15 deletions.
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
*.sublime-*

# Folders
.DS_Store
build
gtest
gtest*
/.DS_Store
/build
/gtest
/gtest*
/boost
/boost*

# Python
*__pycache__*
Expand Down
46 changes: 46 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

cmake_minimum_required(VERSION 2.8)

include(cmake/settings.cmake)
include(cmake/version.cmake)

if(${CMAKE_VERSION} VERSION_GREATER "3.0")
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0048 NEW)
project(${MYSQL_PROJECT_NAME} VERSION ${PROJECT_VERSION_TEXT} LANGUAGES C CXX)
else()
project(${MYSQL_PROJECT_NAME})
endif()

# Required tools and libraries
find_package(Threads REQUIRED)
include(cmake/boost.cmake)
include(cmake/python.cmake)

# Enable testing
if(ENABLE_TESTS)
include(cmake/gtest.cmake)
include(cmake/testing.cmake)
enable_testing()
add_subdirectory(tests)
endif()

# Compiler & Linker settings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

# Load all modules, including plugins
add_subdirectory(src)
1 change: 1 addition & 0 deletions README.md
52 changes: 41 additions & 11 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
MySQL Router 1.0
================

This is a release of MySQL Router, part of MySQL Fabric 1.6.

This is a release of MySQL Router.
For the avoidance of doubt, this particular copy of the software
is released under the version 2 of the GNU General Public License.
MySQL Router is brought to you by Oracle.

Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.


Running Tests
-------------

All tests can be run doing the following:

shell> mkdir build
shell> cd build
shell> cmake ..
shell> make
shell> make test

After running `make`, test executables and scripts are available
in the folder `tests/bin`. You can directly execute these tests
like this:

shell> ./tests/bin/tools/boost_libs
shell> python -B tests/bin/tools/python_exec.py


Documentation
-------------

For further information about MySQL Router or additional
documentation, see:

* The latest information about MySQL: http://www.mysql.com
* The current MySQL Router documentation: http://dev.mysql.com/doc

You can browse the MySQL Reference Manual online or download it
in any of several formats at the URL given earlier in this file.
Source distributions include a local copy of the manual in the
Docs directory.


License
-------

License information can be found in the License.txt file.

MySQL FOSS License Exception
Expand Down Expand Up @@ -35,13 +75,3 @@ Oracle elects to use only the General Public License version 2
license versions is made available with the language indicating
that GPLv2 or any later version may be used, or where a choice
of which version of the GPL is applied is otherwise unspecified.

For further information about MySQL Router or additional
documentation, see:
- The latest information about MySQL: http://www.mysql.com
- The current MySQL Router documentation: http://dev.mysql.com/doc

You can browse the MySQL Reference Manual online or download it
in any of several formats at the URL given earlier in this file.
Source distributions include a local copy of the manual in the
Docs directory.
Loading

0 comments on commit abf32b7

Please sign in to comment.