Files
bacnet_stack/test/CMakeLists.txt
T
Ondřej Hruška 7cdab61d72 Schedule encoding/decoding (#319)
* schedule: add decode_daily_schedule() and encode_daily_schedule()

* schedule: encode/decode implemented + add to bacapp

* add safe encode/decode functions for timevalue, schedule function renaming

* fix unit tests build failing

* add IDEA and test temporary files to .gitignore

* try to make "deprecated" work in MSVC

* add WeeklySchedule compare function

* add bacnet_weeklyschedule_context_decode()

* Add basic test for WeeklySchedule

* Fix WeeklySchedule parsing and snprintf, decoder verified with real hardware

* try to fix windows build

* improve boolean parsing in 'bacapp_parse_application_data'

* add parse function for weekly schedule

* allow types > 16 in bacwp, show the decoded value before sending

* add bacapp binaries to gitignore

* remove bacwp logging

* Add error checking to bacapp_parse_application_data

* try to fix windows build

* fix avr build

* Fix error handling in RP Ack

* add singleDay flag

* show day name in single day weeklyschedule snprintf

* show weeklyschedule inner tag in snprintf

* improve weeklyschedule parsing and printing, supports type names now

* add weekly schedule to bacapp_decode_data

* move bacnet/bacnet_plat_compat.h to bacnet/basic/sys/platform.h

* disable tag limit also in bacwpm

* add ifdef's around strtoX helper functions in bacapp

* move strtox to BACAPP_PRINT_ENABLED ifdef in bacapp

* fix stm32 makefiles

* fix at91sam7s build

* use BACNET_UNSIGNED_INTEGER in BACnet_Short_Application_Data_Value

* fix capitalization in BACnet_Daily_Schedule

* add name to BACNET_TIME_VALUE struct

* change bacwp bacwpm to use bacapp_known_property_tag()

* fix some macros in bacdcode missing parentheses

* Remove dummy fields from BACNET_SHORT_APPLICATION_DATA_VALUE, replace remaining uses of upcasting (adds extra overhead but is maybe safer), rename short DV to Primitive

* fix new ci warnings

* more fixes for ancient C

* fix tests no longer building

* primitive value renamed to shorter name
2022-09-05 09:27:15 -05:00

148 lines
4.0 KiB
CMake

# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
# set the project name
project(Unit_Tests)
# add definitions
add_definitions(-fprofile-arcs -ftest-coverage)
# Set the compiler options
if (NOT MSVC)
add_compile_options(-Wall -g -O0 -W -fprofile-arcs -ftest-coverage)
# ignore some warnings that occur during unit testing
add_compile_options(-Wno-unused-variable -Wno-unused-function)
add_compile_options(-Wno-sign-compare -Wno-unused-parameter)
add_link_options(-fprofile-arcs -ftest-coverage)
endif()
# Create the lcov target. Run result tests with 'make lcov'
add_custom_target(lcov
COMMAND mkdir -p lcoverage
)
add_custom_command(TARGET lcov
COMMAND echo "=================== LCOV ===================="
COMMAND echo "-- Passing lcov tool under code coverage"
COMMAND lcov --capture --directory ../ --output-file lcoverage/main_coverage.info
COMMAND echo "-- Generating HTML output files"
COMMAND genhtml lcoverage/main_coverage.info --output-directory lcoverage
)
#
# add tests
#
list(APPEND testdirs
bacnet/abort
bacnet/alarm_ack
bacnet/arf
bacnet/awf
bacnet/bacapp
bacnet/bacdcode
bacnet/bacdevobjpropref
bacnet/bacerror
bacnet/bacint
bacnet/bacpropstates
bacnet/bacreal
bacnet/bacstr
bacnet/bactimevalue
bacnet/cov
bacnet/datetime
bacnet/dcc
bacnet/event
bacnet/getalarm
bacnet/getevent
bacnet/iam
bacnet/ihave
bacnet/indtext
bacnet/lighting
bacnet/lso
bacnet/memcopy
bacnet/npdu
bacnet/property
bacnet/ptransfer
bacnet/rd
bacnet/reject
bacnet/rp
bacnet/rpm
bacnet/timestamp
bacnet/timesync
bacnet/whohas
bacnet/whois
bacnet/wp
bacnet/weeklyschedule
)
# bacnet/basic/*
list(APPEND testdirs
# basic/object/binding
bacnet/basic/binding/address
# basic/object
bacnet/basic/object/acc
bacnet/basic/object/access_credential
bacnet/basic/object/access_door
bacnet/basic/object/access_point
bacnet/basic/object/access_rights
bacnet/basic/object/access_user
bacnet/basic/object/access_zone
bacnet/basic/object/ai
bacnet/basic/object/ao
bacnet/basic/object/av
bacnet/basic/object/bi
bacnet/basic/object/bo
bacnet/basic/object/bv
bacnet/basic/object/color_object
bacnet/basic/object/color_temperature
bacnet/basic/object/command
bacnet/basic/object/credential_data_input
bacnet/basic/object/device
#bacnet/basic/object/lc #Tests skipped, redesign to use only API
bacnet/basic/object/lo
bacnet/basic/object/lsp
bacnet/basic/object/ms-input
bacnet/basic/object/mso
bacnet/basic/object/msv
bacnet/basic/object/netport
bacnet/basic/object/objects
bacnet/basic/object/osv
bacnet/basic/object/piv
bacnet/basic/object/schedule
# basic/sys
bacnet/basic/sys/color_rgb
bacnet/basic/sys/days
bacnet/basic/sys/fifo
bacnet/basic/sys/filename
bacnet/basic/sys/keylist
bacnet/basic/sys/ringbuf
bacnet/basic/sys/sbuf
)
# bacnet/datalink/*
list(APPEND testdirs
bacnet/datalink/cobs
bacnet/datalink/crc
bacnet/datalink/bvlc
)
enable_testing()
foreach(testdir IN ITEMS ${testdirs})
get_filename_component(basename ${testdir} NAME)
add_subdirectory(${testdir})
add_test(build_${basename}
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--target test_${basename}
)
add_test(test_${basename} ${testdir}/test_${basename})
set_tests_properties(test_${basename} PROPERTIES FIXTURES_REQUIRED test_fixture)
set_tests_properties(build_${basename} PROPERTIES FIXTURES_SETUP test_fixture)
endforeach()
message(STATUS "BACNET: using cmake:....................\"${CMAKE_VERSION}\"")
message(STATUS "BACNET: CMAKE_C_COMPILER_ID:............\"${CMAKE_C_COMPILER_ID}\"")
message(STATUS "BACNET: CMAKE_C_COMPILER_VERSION:.......\"${CMAKE_C_COMPILER_VERSION}\"")
message(STATUS "BACNET: CMAKE_CXX_COMPILER_ID:..........\"${CMAKE_CXX_COMPILER_ID}\"")
message(STATUS "BACNET: CMAKE_CXX_COMPILER_VERSION:.....\"${CMAKE_CXX_COMPILER_VERSION}\"")
message(STATUS "BACNET: CMAKE_INSTALL_PREFIX:...........\"${CMAKE_INSTALL_PREFIX}\"")