]> xenbits.xensource.com Git - unikraft/libs/googletest.git/commitdiff
Initial port of googletest to Unikraft RELEASE-0.4 RELEASE-0.5
authorVlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro>
Mon, 22 Jul 2019 16:29:57 +0000 (16:29 +0000)
committerFelipe Huici <felipe.huici@neclab.eu>
Tue, 23 Jul 2019 12:57:22 +0000 (14:57 +0200)
This is our initial port of googletest to Unikraft as an external
library. libcxx is required. This library should be added last to the
dependency list, e.g.,:

    ...:$(UK_LIBS)/libunwind:$(UK_LIBS)/compiler-rt:$(UK_LIBS)/libcxxabi:
        $(UK_LIBS)/libcxx:$(UK_LIBS)/newlib:$(UK_LIBS)/googletest:...

This library has a config option called LIBGOOGLETEST_BUILD_MAIN that builds the
gtest_main.cc file; this is because some libraries do not have any main function
in their unit tests and expect googletest to provide it.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
COPYING.md
Config.uk [new file with mode: 0644]
Makefile.uk [new file with mode: 0644]
README.md

index e28f3efe94c5d958eaa98b6864889864246649ec..9fb63be2438835ad8b3f5050aeded22aa434f080 100644 (file)
@@ -1,7 +1,7 @@
 License
 =======
 
-Unikraft fxdiv wrappers
+Unikraft googletest wrapper
 -----------------------
 
 This repository contains wrapper code to build googletest with Unikraft.
diff --git a/Config.uk b/Config.uk
new file mode 100644 (file)
index 0000000..862d4ee
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,10 @@
+menuconfig LIBGOOGLETEST
+    bool "Google Testing and Mocking Framework"
+    select LIBCXX
+    default n
+
+if LIBGOOGLETEST
+    config LIBGOOGLETEST_BUILD_MAIN
+    bool "Build googletest with main"
+    default n
+endif
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644 (file)
index 0000000..91f654e
--- /dev/null
@@ -0,0 +1,75 @@
+#  libgoogletest Makefile.uk
+#
+#  Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
+#
+#  Copyright (c) 2019, Politehnica University of Bucharest. All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from
+#     this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libgoogletest,$(CONFIG_LIBGOOGLETEST)))
+
+################################################################################
+# Sources
+################################################################################
+LIBGOOGLETEST_VERSION=1.8.1
+LIBGOOGLETEST_URL=https://github.com/google/googletest/archive/release-$(LIBGOOGLETEST_VERSION).zip
+$(eval $(call fetch,libgoogletest,$(LIBGOOGLETEST_URL)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBGOOGLETEST_SUBDIR=googletest-release-$(LIBGOOGLETEST_VERSION)
+LIBGOOGLETEST_SRC = $(LIBGOOGLETEST_ORIGIN)/$(LIBGOOGLETEST_SUBDIR)
+
+################################################################################
+# Library includes
+################################################################################
+CINCLUDES-$(CONFIG_LIBGOOGLETEST) += -I$(LIBGOOGLETEST_SRC)/googletest/
+CINCLUDES-$(CONFIG_LIBGOOGLETEST) += -I$(LIBGOOGLETEST_SRC)/googletest/include
+
+CXXINCLUDES-$(CONFIG_LIBGOOGLETEST) += -I$(LIBGOOGLETEST_SRC)/googletest/
+CXXINCLUDES-$(CONFIG_LIBGOOGLETEST) += -I$(LIBGOOGLETEST_SRC)/googletest/include
+
+################################################################################
+# Global flags
+################################################################################
+CONFIG_FLAGS += -D GTEST_HAS_CXXABI_H_ -D GTEST_LANG_CXX11
+LIBGOOGLETEST_CFLAGS-y         += $(CONFIG_FLAGS)
+LIBGOOGLETEST_CXXFLAGS-y       += $(CONFIG_FLAGS)
+
+################################################################################
+# Library sources
+################################################################################
+ifdef CONFIG_LIBGOOGLETEST_BUILD_MAIN
+LIBGOOGLETEST_SRCS-y += $(LIBGOOGLETEST_SRC)/googletest/src/gtest_main.cc
+endif
+LIBGOOGLETEST_SRCS-y += $(LIBGOOGLETEST_SRC)/googletest/src/gtest-all.cc
index 769a3a6cc1b6a2494ebbd36cc21f0da5ef3b6d2d..d0344ef5e309cbac7f4e9ac20a91d277412e7988 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,5 +1,19 @@
 googletest for Unikraft
 ===================
 
-Please refer to the `README.md` as well as the documentation in the `doc/`
-subdirectory of the main unikraft repository.
+This is the port of googletest to Unikraft as an external
+library. libcxx is required. This library should come at the end of
+the dependency list, e.g.,:
+
+       ...:$(UK_LIBS)/libunwind:$(UK_LIBS)/compiler-rt:$(UK_LIBS)/libcxxabi:
+        $(UK_LIBS)/libcxx:$(UK_LIBS)/newlib:$(UK_LIBS)/googletest:...
+                                        
+This library has a config option called LIBGOOGLETEST_BUILD_MAIN that
+builds the gtest_main.cc file. This is because some libraries do not
+have any main function in their unit tests and expect googletest to
+provide it.
+                                                                
+Please refer to the `README.md` as well as the documentation in the
+`doc/` subdirectory of the main unikraft repository for further
+information.
+