Skip to content

Commit

Permalink
ci: added module registration test so we don't depend on module CIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ncorgan committed Nov 27, 2022
1 parent da7b199 commit f8d5765
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ jobs:
${PYTHON3_EXECUTABLE} -c "from SoapySDR import *; print(SOAPY_SDR_TIMEOUT)"
${PYTHON3_EXECUTABLE} -c "import SoapySDR; print(SoapySDR.errToStr(SoapySDR.SOAPY_SDR_TIMEOUT))"
${PYTHON3_EXECUTABLE} -c "import SoapySDR; print(SoapySDR.Device.make('driver=null'))"
- name: Test module registration
run: |
mkdir -p ${{github.workspace}}/build-example
cd ${{github.workspace}}/build-example
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}/ExampleDriver
sudo make install
SoapySDRUtil --check=my_device
osx-ci:
name: OS X
strategy:
Expand Down Expand Up @@ -158,6 +165,13 @@ jobs:
SoapySDRUtil --info
SoapySDRUtil --check=null
SoapySDRUtil --make="driver=null"
- name: Test module registration
run: |
mkdir -p ${{github.workspace}}/build-example
cd ${{github.workspace}}/build-example
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}/ExampleDriver
sudo make install
SoapySDRUtil --check=my_device
windows-ci:
name: Windows
strategy:
Expand Down Expand Up @@ -209,7 +223,7 @@ jobs:
os: windows-2019
msvc: false

# TODO: reenable after fix
# TODO: reenable if Github updates GCC past 11.2
#- cmake_config: -G "MinGW Makefiles"
# os: windows-2022
# msvc: false
Expand Down Expand Up @@ -245,10 +259,20 @@ jobs:
SoapySDRUtil --info
SoapySDRUtil --check=null
SoapySDRUtil --make="driver=null"
- name: Test module registration
run: |
$Env:PATH += ";$Env:INSTALL_PREFIX\bin"
mkdir -p ${{github.workspace}}\build-example
cd ${{github.workspace}}\build-example
cmake ${{matrix.config.cmake_config}} -DCMAKE_INSTALL_PREFIX="$Env:INSTALL_PREFIX" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}\ExampleDriver
cmake --build . --config ${{matrix.build_type}}
cmake --install . --config ${{matrix.build_type}}
SoapySDRUtil --check=my_device
freebsd-ci:
name: FreeBSD
runs-on: macos-12
env:
INSTALL_PREFIX: /usr/local
PYTHON_EXECUTABLE: /usr/local/bin/python3.9
strategy:
fail-fast: false
Expand All @@ -260,7 +284,7 @@ jobs:
- uses: vmactions/freebsd-vm@v0
name: Test in FreeBSD
with:
envs: "PYTHON_EXECUTABLE"
envs: "INSTALL_PREFIX PYTHON_EXECUTABLE"
release: ${{matrix.release}}
copyback: false
prepare: |
Expand All @@ -274,7 +298,7 @@ jobs:
echo "----------------------------------"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ..
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}
make
echo
Expand Down Expand Up @@ -306,3 +330,13 @@ jobs:
${PYTHON_EXECUTABLE} -c "from SoapySDR import *; print(SOAPY_SDR_TIMEOUT)" || exit 1
${PYTHON_EXECUTABLE} -c "import SoapySDR; print(SoapySDR.errToStr(SoapySDR.SOAPY_SDR_TIMEOUT))" || exit 1
${PYTHON_EXECUTABLE} -c "import SoapySDR; print(SoapySDR.Device.make('driver=null'))" || exit 1
echo
echo "----------------------------------"
echo "Testing module registration..."
echo "----------------------------------"
mkdir -p ${{github.workspace}}/build-example
cd ${{github.workspace}}/build-example
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}/ExampleDriver
make install
SoapySDRUtil --check=my_device
4 changes: 2 additions & 2 deletions ExampleDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# Header and library resources needed to communicate with the device.
# These may be found within the build tree or in an external project.
########################################################################
set(MY_DEVICE_INCLUDE_DIRS ...)
set(MY_DEVICE_LIBRARIES ...)
set(MY_DEVICE_INCLUDE_DIRS "")
set(MY_DEVICE_LIBRARIES "")

########################################################################
# build the module
Expand Down
6 changes: 5 additions & 1 deletion ExampleDriver/MyDeviceSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@ class MyDevice : public SoapySDR::Device
**********************************************************************/
SoapySDR::KwargsList findMyDevice(const SoapySDR::Kwargs &args)
{
(void)args;
//locate the device on the system...
//return a list of 0, 1, or more argument maps that each identify a device

return SoapySDR::KwargsList();
}

/***********************************************************************
* Make device instance
**********************************************************************/
SoapySDR::Device *makeMyDevice(const SoapySDR::Kwargs &args)
{
(void)args;
//create an instance of the device object given the args
//here we will translate args into something used in the constructor
return new MyDevice(...);
return new MyDevice();
}

/***********************************************************************
Expand Down
6 changes: 5 additions & 1 deletion cmake/Modules/SoapySDRUtil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ function(SOAPY_SDR_MODULE_UTIL)
if(CMAKE_COMPILER_IS_GNUCXX)
#force a compile-time error when symbols are missing
#otherwise modules will cause a runtime error on load
target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,--no-undefined")
if(APPLE)
target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,-undefined,error")
else()
target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,--no-undefined")
endif()
endif()

if (NOT MODULE_DESTINATION)
Expand Down

0 comments on commit f8d5765

Please sign in to comment.