mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
Merge commit 'b19a54d2f9d8a3e83366c638aace4cf3b5daa96e' as 'build/dobuild'
This commit is contained in:
19
build/dobuild/tests/fixtures/cmake-gtest-example/CMakeLists.txt
vendored
Normal file
19
build/dobuild/tests/fixtures/cmake-gtest-example/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(cmake-gtest-example)
|
||||
|
||||
option(POSITION_INDEPENDENT_CODE "This variable is used to initialize the POSITION_INDEPENDENT_CODE property on all the targets" ON)
|
||||
|
||||
include(CTest)
|
||||
|
||||
add_executable(alltests
|
||||
test_stringcompare.cpp
|
||||
)
|
||||
|
||||
target_include_directories(alltests PUBLIC ${GTEST_INCLUDE_DIRS})
|
||||
target_compile_options(alltests PUBLIC -Wall -Wextra ${GTEST_CFLAGS})
|
||||
target_link_libraries(alltests PUBLIC -pthread ${GTEST_LIBRARIES} gtest_main gtest)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME alltests COMMAND alltests)
|
||||
|
||||
95
build/dobuild/tests/fixtures/cmake-gtest-example/Makefile
vendored
Normal file
95
build/dobuild/tests/fixtures/cmake-gtest-example/Makefile
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
SHELL := /bin/sh
|
||||
MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
.PHONY: default
|
||||
default: all
|
||||
|
||||
#######################################################################################################################
|
||||
# Overridable project defaults
|
||||
|
||||
DOBUILD_TOPDIR ?= $(DOBUILDDIR)
|
||||
DOBUILD_PROJECTDIR ?= $(patsubst %/,%,$(dir $(MAKEFILE)))
|
||||
|
||||
PROJECTDIR = $(DOBUILD_PROJECTDIR)
|
||||
DOBUILDDIR ?= $(PROJECTDIR)/../../..
|
||||
|
||||
include $(DOBUILDDIR)/defaults.mk
|
||||
|
||||
#######################################################################################################################
|
||||
# Project defaults and macros
|
||||
|
||||
DEFAULTTARGET = x86_64-ubuntu@bionic+builder
|
||||
|
||||
FETCHDIR = $(BUILDDIR)/.deps
|
||||
|
||||
#######################################################################################################################
|
||||
# Project dependencies
|
||||
|
||||
DUMB_INIT_VERSION = 1.2.2
|
||||
IMAGE_BUILDARGS += DUMB_INIT_VERSION=$(DUMB_INIT_VERSION)
|
||||
IMAGE_BUILDARGS += DUMB_INIT_MTIME=$(call mtime,$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz)
|
||||
FETCH_TARGETS += $(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz
|
||||
$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: URL = https://github.com/Yelp/dumb-init/archive/v$(DUMB_INIT_VERSION).tar.gz
|
||||
$(SKIP_MD5SUM)$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: MD5 = 6166084b05772cdcf615a762c6f3b32e
|
||||
|
||||
GTEST_VERSION = 1.8.0
|
||||
IMAGE_BUILDARGS += GTEST_VERSION=$(GTEST_VERSION)
|
||||
IMAGE_BUILDARGS += GTEST_MTIME=$(call mtime,$(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz)
|
||||
FETCH_TARGETS += $(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz
|
||||
$(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz: URL := https://github.com/google/googletest/archive/release-$(GTEST_VERSION).tar.gz
|
||||
$(SKIP_MD5SUM)$(FETCHDIR)/googletest-release-$(GTEST_VERSION).tar.gz: MD5 := 16877098823401d1bf2ed7891d7dce36
|
||||
|
||||
#######################################################################################################################
|
||||
# Architecture-specific rule target configuration
|
||||
|
||||
CMAKE_TARGETS += x86_64-ubuntu@bionic+builder
|
||||
DOCKER_TARGETS += $(CMAKE_TARGETS)
|
||||
|
||||
#######################################################################################################################
|
||||
# Common rule target configuration
|
||||
|
||||
CURLFLAGS += -s
|
||||
|
||||
DOCKER_RUNFLAGS += --cap-add SYS_PTRACE
|
||||
DOCKER_RUNFLAGS += --security-opt seccomp=unconfined
|
||||
|
||||
OUTDIRS += $(OUTDIR)/src
|
||||
|
||||
EXTRACT_TARGETS += $(patsubst $(FETCHDIR)/%.tar.gz,$(OUTDIR)/src/%,$(FETCH_TARGETS))
|
||||
|
||||
#######################################################################################################################
|
||||
# Makefile dependencies
|
||||
|
||||
MAKEFILE_DEPS += gzip
|
||||
MAKEFILE_DEPS += tar
|
||||
MAKEFILE_DEPS += touch
|
||||
MAKEFILE_DEPS += cp
|
||||
MAKEFILE_DEPS += mkdir
|
||||
|
||||
#######################################################################################################################
|
||||
# Rules
|
||||
|
||||
include $(DOBUILDDIR)/cmake.mk
|
||||
include $(DOBUILDDIR)/docker.mk
|
||||
include $(DOBUILDDIR)/standardrules.mk
|
||||
|
||||
$(OUTDIR)/src/%: $(FETCHDIR)/%.tar.gz | $(OUTDIRS)
|
||||
$(SILENT) \
|
||||
$(call echo_if_silent_cmd,tar -C $(dir $@) -xf $<) \
|
||||
&& tar -I 'gzip -n' -C $(dir $@) -xf $< \
|
||||
&& touch $@
|
||||
|
||||
$(OUTDIR)/docker/%.dockerfile : $(PROJECTDIR)/%.dockerfile | $(OUTDIRS)
|
||||
cp $< $@
|
||||
|
||||
$(FETCH_TARGETS): | $(FETCHDIR)
|
||||
$(SILENT)$(call curl,$@,$(URL),$(MD5))
|
||||
|
||||
$(FETCHDIR):
|
||||
$(SILENT)mkdir -p $@
|
||||
|
||||
.DELETE_ON_ERROR: $(FETCH_TARGETS)
|
||||
|
||||
24
build/dobuild/tests/fixtures/cmake-gtest-example/test_stringcompare.cpp
vendored
Normal file
24
build/dobuild/tests/fixtures/cmake-gtest-example/test_stringcompare.cpp
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
|
||||
char const actualValTrue[] = "hello gtest";
|
||||
char const actualValFalse[] = "hello world";
|
||||
char const expectVal[] = "hello gtest";
|
||||
|
||||
TEST(StrCompare, Equal)
|
||||
{
|
||||
EXPECT_STREQ(expectVal, actualValTrue);
|
||||
}
|
||||
|
||||
TEST(StrCompare, NotEqual)
|
||||
{
|
||||
EXPECT_STRNE(expectVal, actualValFalse);
|
||||
}
|
||||
|
||||
TEST(StrCompare, WithNonReproducibleValues)
|
||||
{
|
||||
EXPECT_STREQ(__DATE__, __DATE__);
|
||||
EXPECT_STREQ(__TIME__, __TIME__);
|
||||
}
|
||||
94
build/dobuild/tests/fixtures/cmake-gtest-example/x86_64-ubuntu-builder.dockerfile
vendored
Normal file
94
build/dobuild/tests/fixtures/cmake-gtest-example/x86_64-ubuntu-builder.dockerfile
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
ARG REGISTRY_PREFIX=''
|
||||
ARG CODENAME=bionic
|
||||
|
||||
FROM ${REGISTRY_PREFIX}ubuntu:${CODENAME} as builder
|
||||
|
||||
ARG TZ=UTC
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=${LANG}
|
||||
|
||||
RUN set -x \
|
||||
&& installdeps="tzdata" \
|
||||
&& rm -f /etc/apt/sources.list.d/*.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends $installdeps \
|
||||
&& ls /usr/share/zoneinfo \
|
||||
&& cp -H --remove-destination "/usr/share/zoneinfo/$TZ" /tmp/localtime \
|
||||
&& { apt-get purge -y $installdeps || true; } \
|
||||
&& mv /tmp/localtime /etc/localtime \
|
||||
&& echo "$TZ" > /etc/timezone \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY src /usr/local/src
|
||||
|
||||
ARG PARALLELMFLAGS=-j2
|
||||
|
||||
ARG DUMB_INIT_VERSION=1.2.2
|
||||
ARG DUMB_INIT_MTIME=
|
||||
RUN set -x \
|
||||
&& builddeps="vim-common" \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends $builddeps \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& [ -n "$DUMB_INIT_MTIME" ] && export SOURCE_DATE_EPOCH="$DUMB_INIT_MTIME" \
|
||||
&& builddir="/tmp/out" \
|
||||
&& mkdir -p "$builddir" \
|
||||
&& cd "$builddir" \
|
||||
&& cp -R "/usr/local/src/dumb-init-$DUMB_INIT_VERSION" . \
|
||||
&& cd "dumb-init-$DUMB_INIT_VERSION" \
|
||||
&& make "$PARALLELMFLAGS" \
|
||||
&& chmod +x dumb-init \
|
||||
&& mv dumb-init /usr/local/bin/dumb-init \
|
||||
&& dumb-init --version \
|
||||
&& rm -rf "$builddir" \
|
||||
&& apt-get purge -y $builddeps
|
||||
|
||||
ARG GTEST_VERSION=1.8.1
|
||||
ARG GTEST_MTIME=
|
||||
|
||||
RUN set -x \
|
||||
&& [ -n "$GTEST_MTIME" ] && export SOURCE_DATE_EPOCH="$GTEST_MTIME" \
|
||||
&& builddir="/tmp/out" \
|
||||
&& mkdir -p "$builddir" \
|
||||
&& cd "$builddir" \
|
||||
&& cmake "/usr/local/src/googletest-release-$GTEST_VERSION" \
|
||||
&& make "$PARALLELMFLAGS" install \
|
||||
&& rm -rf "$builddir"
|
||||
|
||||
FROM ${REGISTRY_PREFIX}ubuntu:${CODENAME}
|
||||
|
||||
ARG TZ=UTC
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=${LANG}
|
||||
|
||||
COPY --from=builder /usr/local /usr/local
|
||||
COPY --from=builder /etc/localtime /etc/localtime
|
||||
COPY --from=builder /etc/timezone /etc/timezone
|
||||
COPY --from=builder /etc/apt/sources.list.d /etc/apt/sources.list.d
|
||||
|
||||
RUN set -x \
|
||||
&& rm -f /etc/apt/sources.list.d/*.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
gdb \
|
||||
gdbserver \
|
||||
valgrind \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
|
||||
|
||||
ARG USERID=1000
|
||||
RUN set -x \
|
||||
&& useradd -u "$USERID" -ms /bin/bash user
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
CMD [ "/bin/bash" ]
|
||||
|
||||
18
build/dobuild/tests/fixtures/make-gtest-example/Makefile
vendored
Normal file
18
build/dobuild/tests/fixtures/make-gtest-example/Makefile
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Makefile for gtest example
|
||||
|
||||
CPPFLAGS = -I /usr/local/include
|
||||
CXXFLAGS = -c -Wall
|
||||
LDFLAGS = -L /usr/local/lib -l gtest_main -l gtest -l pthread
|
||||
|
||||
TARGET = alltests
|
||||
OBJECTS = test_stringcompare.o
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CXX) -o $@ $^ $(LD_FLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(OBJECTS)
|
||||
|
||||
.PHONY: all clean
|
||||
18
build/dobuild/tests/fixtures/make-gtest-example/test_stringcompare.cpp
vendored
Normal file
18
build/dobuild/tests/fixtures/make-gtest-example/test_stringcompare.cpp
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <gtest/gtest.h> // googletest header file
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
|
||||
char const actualValTrue[] = "hello gtest";
|
||||
char const actualValFalse[] = "hello world";
|
||||
char const expectVal[] = "hello gtest";
|
||||
|
||||
TEST(StrCompare, CStrEqual)
|
||||
{
|
||||
EXPECT_STREQ(expectVal, actualValTrue);
|
||||
}
|
||||
|
||||
TEST(StrCompare, CStrNotEqual)
|
||||
{
|
||||
EXPECT_STRNE(expectVal, actualValFalse);
|
||||
}
|
||||
Reference in New Issue
Block a user