Skip to content

Commit

Permalink
Merge 78c0c08 into ff70585
Browse files Browse the repository at this point in the history
  • Loading branch information
yperess committed Aug 5, 2022
2 parents ff70585 + 78c0c08 commit 93ad166
Show file tree
Hide file tree
Showing 69 changed files with 258 additions and 1,545 deletions.
13 changes: 0 additions & 13 deletions .appveyor.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/verify_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check PR

on:
pull_request:
branches:
- master

jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./buildandtest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/

# IntelliJ IDE project directory
.idea/

# Visual C++ cache files
ipch/
*.aps
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2022 Google LLC
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
project(fff)

# Add the gtest library which will be used below
add_subdirectory(gtest)

# Enable ctest
enable_testing()

# Generate fff.h if fakegen.rb changed
add_custom_command(
OUTPUT
${CMAKE_CURRENT_LIST_DIR}/fff.h
COMMAND
cat ${CMAKE_CURRENT_LIST_DIR}/LICENSE > ${CMAKE_CURRENT_LIST_DIR}/fff.h
COMMAND
echo >> ${CMAKE_CURRENT_LIST_DIR}/fff.h
COMMAND
ruby ${CMAKE_CURRENT_LIST_DIR}/fakegen.rb >> ${CMAKE_CURRENT_LIST_DIR}/fff.h
DEPENDS
${CMAKE_CURRENT_LIST_DIR}/fakegen.rb
${CMAKE_CURRENT_LIST_DIR}/LICENSE
)

# Add an interface library for fff.h
add_library(fff INTERFACE)
target_sources(fff PUBLIC ${CMAKE_CURRENT_LIST_DIR}/fff.h)
target_include_directories(fff INTERFACE ${CMAKE_CURRENT_LIST_DIR})

# Add tests and samples
add_subdirectory(test)
add_subdirectory(examples)
10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

28 changes: 12 additions & 16 deletions buildandtest
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#!/bin/bash
set -e

cat LICENSE > fff.h
echo >> fff.h
ruby fakegen.rb >> fff.h
make clean
make all
build/fff_test_c
build/fff_test_cpp --gtest_output=xml:build/test_results.xml
build/ui_test_ansic
build/ui_test_cpp --gtest_output=xml:build/example_results.xml
build/fff_test_glob_c
build/fff_test_glob_cpp --gtest_output=xml:build/test_global_results.xml
build/driver_testing --gtest_output=xml:build/driver_testing.xml
build/driver_testing_fff --gtest_output=xml:build/driver_testing_fff.xml
build/weak_linking/test_display
build/weak_linking/test_sensor
build/weak_linking/test_main
# Clear the environment
rm -fr build fff.h
mkdir build

# Configure the build
cd build
cmake -GNinja ../ || exit -1

# Build all targets
cmake --build . || exit -1

# Run all tests
ctest --output-on-failure
6 changes: 6 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2022 Google LLC
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(driver_testing)
add_subdirectory(embedded_ui)
add_subdirectory(weak_linking)
9 changes: 0 additions & 9 deletions examples/Makefile

This file was deleted.

31 changes: 31 additions & 0 deletions examples/driver_testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2022 Google LLC
# SPDX-License-Identifier: Apache-2.0

# Create the driver test binary
add_executable(driver_test
src/driver.c
src/driver.test.cpp
)
target_include_directories(driver_test PRIVATE include)
target_link_libraries(driver_test PRIVATE gtest fff)
target_compile_definitions(driver_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING)

# Create the driver fff test binary
add_executable(driver_fff_test
src/driver.c
src/driver.test.fff.cpp
)
target_include_directories(driver_fff_test PRIVATE include)
target_link_libraries(driver_fff_test PRIVATE gtest fff)
target_compile_definitions(driver_fff_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING)

# Add tests to ctest
add_test(
NAME driver_test
COMMAND $<TARGET_FILE:driver_test>
)

add_test(
NAME driver_fff_test
COMMAND $<TARGET_FILE:driver_fff_test>
)
64 changes: 0 additions & 64 deletions examples/driver_testing/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern "C"
#include "driver.h"
#include "registers.h"
}
#include "../../fff.h"
#include "../../../fff.h"
#include <gtest/gtest.h>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern "C"{
#include "registers.h"
#include "hardware_abstraction.h"
}
#include "../../fff.h"
#include "fff.h"
#include <gtest/gtest.h>

DEFINE_FFF_GLOBALS;
Expand Down
23 changes: 23 additions & 0 deletions examples/embedded_ui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2022 Google LLC
# SPDX-License-Identifier: Apache-2.0

# Create the ui_test_ansic test binary
add_executable(ui_test_ansic src/UI_test_ansic.c src/UI.c)
target_include_directories(ui_test_ansic PRIVATE include)
target_link_libraries(ui_test_ansic PRIVATE fff)

# Create the ui_test_cpp test binary
add_executable(ui_test_cpp src/UI_test_cpp.cpp src/UI.c)
target_include_directories(ui_test_cpp PRIVATE include)
target_link_libraries(ui_test_cpp PRIVATE gtest fff)

# Add tests to ctest
add_test(
NAME ui_test_ansic
COMMAND $<TARGET_FILE:ui_test_ansic>
)

add_test(
NAME ui_test_cpp
COMMAND $<TARGET_FILE:ui_test_cpp>
)
67 changes: 0 additions & 67 deletions examples/embedded_ui/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "UI.h"
#include "../../fff.h"
#include "fff.h"
#include "SYSTEM.h"
#include "DISPLAY.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern "C"{
#include <gtest/gtest.h>


#include "../../fff.h"
#include "fff.h"
DEFINE_FFF_GLOBALS;

/* SYSTEM.h */
Expand Down
34 changes: 0 additions & 34 deletions examples/embedded_ui/test_suite_template.c

This file was deleted.

Loading

0 comments on commit 93ad166

Please sign in to comment.