Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ on:
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'
pull_request:
paths:
- '.github/workflows/**'
- 'JuceLibraryCode/**'
- 'PluginGenerator/**'
- 'Plugins/**'
- 'Resources/**'
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'

jobs:
build-ubuntu:
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ on:
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'
pull_request:
paths:
- '.github/workflows/**'
- 'JuceLibraryCode/**'
- 'PluginGenerator/**'
- 'Plugins/**'
- 'Resources/**'
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'

jobs:
build-osx:
Expand Down
129 changes: 129 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Tests

on:
pull_request:
paths:
- 'JuceLibraryCode/**'
- 'Plugins/**'
- 'Resources/**'
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'
branches:
- 'development'
- 'testing'

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: build
env:
CC: gcc-10
CXX: g++-10
run: |
sudo apt update
sudo ./Resources/Scripts/install_linux_dependencies.sh
git apply Resources/Scripts/gha_unit_tests.patch
cd Build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON ..
make -j8
- name: run tests
run: |
chmod +x ./Resources/Scripts/run_unit_tests_linux.sh
./Resources/Scripts/run_unit_tests_linux.sh Build/TestBin
shell: bash

integration-tests:
name: Integration Tests
runs-on: windows-2022

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Start Windows Audio Engine
run: net start audiosrv
- name: Install Scream
shell: powershell
run: |
Start-Service audio*
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
Expand-7ZipArchive -Path C:\Scream3.6.zip -DestinationPath C:\Scream
$cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
cd C:\Scream\Install\driver
C:\Scream\Install\helpers\devcon install Scream.inf *Scream
- name: Show audio device
run: Get-CimInstance Win32_SoundDevice | fl *
- name: configure
run: |
cd Build
cmake -G "Visual Studio 17 2022" -A x64 ..
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: build
run: |
cd Build
msbuild ALL_BUILD.vcxproj -p:Configuration=Release -p:Platform=x64 -m
- name: Install open-ephys-data-format
shell: powershell
run: |
New-Item -Path '..\OEPlugins' -ItemType Directory
git clone --branch main https://github.com/open-ephys-plugins/open-ephys-data-format.git ..\OEPlugins\open-ephys-data-format
cd ..\OEPlugins\open-ephys-data-format\Build
cmake -G "Visual Studio 17 2022" -A x64 ..
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
- name: Install OpenEphysHDF5Lib
shell: powershell
run: |
git clone --branch main https://github.com/open-ephys-plugins/OpenEphysHDF5Lib.git ..\OEPlugins\OpenEphysHDF5Lib
cd ..\OEPlugins\OpenEphysHDF5Lib\Build
cmake -G "Visual Studio 17 2022" -A x64 ..
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
- name: Install nwb-format
shell: powershell
run: |
git clone --branch main https://github.com/open-ephys-plugins/nwb-format.git ..\OEPlugins\nwb-format
cd ..\OEPlugins\nwb-format\Build
cmake -G "Visual Studio 17 2022" -A x64 ..
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
- name: Install test-suite
shell: powershell
run: |
git clone --branch main https://github.com/open-ephys/open-ephys-python-tools.git C:\open-ephys-python-tools
cd C:\open-ephys-python-tools
pip install -e .
pip install psutil
- name: Run Tests
shell: powershell
run: |
New-Item -Path 'C:\open-ephys\data' -ItemType Directory
git clone --branch main https://github.com/open-ephys/open-ephys-test-suite.git C:\test-suite
cd C:\test-suite
$process = Start-Process -FilePath "Build\Release\open-ephys.exe" -ArgumentList "Build\Release\configs\file_reader_config.xml" -NoNewWindow -PassThru
Write-Host "Started open-ephys process with ID: $($process.Id)"
Start-Sleep -Seconds 10
Write-Host "Starting Python script..."
python run_all.py 2>&1 | Tee-Object -FilePath "python_output.log"
Write-Host "Python script completed. Output saved to python_output.log"
Stop-Process -Id $process.Id -Force
env:
OE_WINDOWS_GITHUB_RECORD_PATH: C:\open-ephys\data
- name: Set timestamp
shell: powershell
id: timestamp
run: |
$timestamp = Get-Date -Format 'yyyy_MM_dd_HH_mm_ss'
"timestamp=$timestamp" >> $env:GITHUB_OUTPUT
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: windows_${{ steps.timestamp.outputs.timestamp }}.log
path: python_output.log
retention-days: 7
10 changes: 0 additions & 10 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ on:
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'
pull_request:
paths:
- '.github/workflows/**'
- 'JuceLibraryCode/**'
- 'PluginGenerator/**'
- 'Plugins/**'
- 'Resources/**'
- 'Source/**'
- 'CMakeLists.txt'
- 'HelperFunctions.cmake'

jobs:
build-windows:
Expand Down
8 changes: 4 additions & 4 deletions Plugins/LfpViewer/Tests/LfpDisplayNodeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ TEST_F (LfpDisplayNodeTests, VisualIntegrityTest)
Rectangle<int> canvasSnapshot (x, y, width, height);
ExpectedImage expected (numChannels, sampleRate * 2); //2 seconds to match canvas timebase

tester->startAcquisition (false);
processor->startAcquisition ();
canvas->beginAnimation();

//Add 5 10Hz waves with +-125uV amplitude
Expand Down Expand Up @@ -367,16 +367,16 @@ TEST_F (LfpDisplayNodeTests, VisualIntegrityTest)
missCount = getImageDifferencePixelCount (expectedImage, canvasImage);
EXPECT_LE (float (missCount) / float (width * height), errorThreshold);

tester->stopAcquisition();
processor->stopAcquisition();
}

TEST_F (LfpDisplayNodeTests, DataIntegrityTest)
{
int numSamples = 100;
tester->startAcquisition (false);
processor->startAcquisition ();

auto inputBuffer = createBuffer (1000.0, 20.0, numChannels, numSamples);
writeBlock (inputBuffer);

tester->stopAcquisition();
processor->stopAcquisition();
}
15 changes: 15 additions & 0 deletions Resources/Scripts/gha_unit_tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/Tests/Processors/CMakeLists.txt b/Tests/Processors/CMakeLists.txt
index a89fa4da4..ab53e8d89 100644
--- a/Tests/Processors/CMakeLists.txt
+++ b/Tests/Processors/CMakeLists.txt
@@ -5,8 +5,8 @@ add_sources(${COMPONENT_NAME}_tests
DataBufferTests.cpp
PluginManagerTests.cpp
SourceNodeTests.cpp
- RecordNodeTests.cpp
- ProcessorGraphTests.cpp
+ #RecordNodeTests.cpp
+ #ProcessorGraphTests.cpp
EventTests.cpp
DataThreadTests.cpp
GenericProcessorTests.cpp
20 changes: 20 additions & 0 deletions Resources/Scripts/run_unit_tests_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Use first argument as TEST_DIR if provided, otherwise use default
TEST_DIR="${1:-../../Build/TestBin}"

# Track overall exit code
EXIT_CODE=0

# Find all executable files that are not .so files
for test_exec in $(find "$TEST_DIR" -type f -executable ! -name "*.so"); do
echo "Running test: $test_exec"
"$test_exec"
TEST_RESULT=$?
if [ $TEST_RESULT -ne 0 ]; then
EXIT_CODE=1
fi
echo "----------------------------------------"
done

exit $EXIT_CODE
4 changes: 2 additions & 2 deletions Tests/Processors/DataThreadTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ class DataThreadTests : public testing::Test

TEST_F(DataThreadTests, DataIntegrity)
{
tester->startAcquisition(false);
processor->startAcquisition();

int numSamples = 100;
auto inputBuffer = createBuffer(1000.0, 20.0, 5, numSamples);
writeBlock(inputBuffer);

tester->stopAcquisition();
processor->stopAcquisition();
}
28 changes: 14 additions & 14 deletions Tests/Processors/RecordNodeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ class RecordNodeTests : public testing::Test {

TEST_F(RecordNodeTests, TestInputOutput_Continuous_Single) {
int numSamples = 100;
tester->startAcquisition(true);
processor->startAcquisition();

auto inputBuffer = createBuffer(1000.0, 20.0, numChannels, numSamples);
writeBlock(inputBuffer);

// The record node always flushes its pending writes when stopping acquisition, so we don't need to sleep before
// stopping.
tester->stopAcquisition();
processor->stopAcquisition();

std::vector<int16_t> persistedData;
loadContinuousDatFile(&persistedData);
Expand All @@ -245,7 +245,7 @@ TEST_F(RecordNodeTests, TestInputOutput_Continuous_Single) {
}

TEST_F(RecordNodeTests, TestInputOutput_Continuous_Multiple) {
tester->startAcquisition(true);
processor->startAcquisition();

int numSamplesPerBlock = 100;
int numBlocks = 8;
Expand All @@ -256,7 +256,7 @@ TEST_F(RecordNodeTests, TestInputOutput_Continuous_Multiple) {
inputBuffers.push_back(inputBuffer);
}

tester->stopAcquisition();
processor->stopAcquisition();

std::vector<int16_t> persistedData;
loadContinuousDatFile(&persistedData);
Expand All @@ -277,8 +277,8 @@ TEST_F(RecordNodeTests, TestInputOutput_Continuous_Multiple) {
}

TEST_F(RecordNodeTests, TestEmpty) {
tester->startAcquisition(true);
tester->stopAcquisition();
processor->startAcquisition();
processor->stopAcquisition();

std::vector<int16_t> persistedData;
loadContinuousDatFile(&persistedData);
Expand All @@ -287,7 +287,7 @@ TEST_F(RecordNodeTests, TestEmpty) {

TEST_F(RecordNodeTests, TestClipsProperly) {
int numSamples = 100;
tester->startAcquisition(true);
processor->startAcquisition();

// The min value is actually -32767, not -32768 like the "true" min
std::vector<AudioBuffer<float>> inputBuffers;
Expand All @@ -301,7 +301,7 @@ TEST_F(RecordNodeTests, TestClipsProperly) {
writeBlock(inputBuffer);
inputBuffers.push_back(inputBuffer);

tester->stopAcquisition();
processor->stopAcquisition();

std::vector<int16_t> persistedData;
loadContinuousDatFile(&persistedData);
Expand Down Expand Up @@ -341,10 +341,10 @@ class CustomBitVolts_RecordNodeTests : public RecordNodeTests {

TEST_F(CustomBitVolts_RecordNodeTests, Test_RespectsBitVolts) {
int numSamples = 100;
tester->startAcquisition(true);
processor->startAcquisition();
auto inputBuffer = createBuffer(1000.0, 20.0, numChannels, numSamples);
writeBlock(inputBuffer);
tester->stopAcquisition();
processor->stopAcquisition();

std::vector<int16_t> persistedData;
loadContinuousDatFile(&persistedData);
Expand All @@ -370,7 +370,7 @@ TEST_F(CustomBitVolts_RecordNodeTests, Test_RespectsBitVolts) {
}

TEST_F(RecordNodeTests, Test_PersistsSampleNumbersAndTimestamps) {
tester->startAcquisition(true);
processor->startAcquisition();

int numSamples = 5;
for (int i = 0; i < 3; i++) {
Expand Down Expand Up @@ -417,7 +417,7 @@ TEST_F(RecordNodeTests, Test_PersistsSampleNumbersAndTimestamps) {
}

TEST_F(RecordNodeTests, Test_PersistsStructureOeBin) {
tester->startAcquisition(true);
processor->startAcquisition();

int numSamples = 5;
for (int i = 0; i < 3; i++) {
Expand Down Expand Up @@ -479,7 +479,7 @@ TEST_F(RecordNodeTests, Test_PersistsEvents) {
processor->setRecordEvents(true);
processor->updateSettings();

tester->startAcquisition(true);
processor->startAcquisition();
int numSamples = 5;

auto streamId = processor->getDataStreams()[0]->getStreamId();
Expand All @@ -492,7 +492,7 @@ TEST_F(RecordNodeTests, Test_PersistsEvents) {
true);
auto inputBuffer = createBuffer(1000.0, 20.0, numChannels, numSamples);
writeBlock(inputBuffer, eventPtr.get());
tester->stopAcquisition();
processor->stopAcquisition();

std::filesystem::path sampleNumbersPath;
ASSERT_TRUE(eventsPathFor("sample_numbers.npy", &sampleNumbersPath));
Expand Down
4 changes: 2 additions & 2 deletions Tests/Processors/SourceNodeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ This test verifies that given a Data Thread, the Source Node will perform this w
*/
TEST_F(SourceNodeTests, DataAcquisition)
{
tester->startAcquisition(false);
tester->getSourceNode()->startAcquisition();

int numSamples = 100;
auto inputBuffer = createBuffer(1000.0, 20.0, 5, numSamples);
writeBlock(inputBuffer);

tester->stopAcquisition();
tester->getSourceNode()->stopAcquisition();
}
Loading
Loading