Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6f68a85
fixed test sort by initializing db and rules
xelArga Sep 9, 2025
4ba44b5
using black format for python linter
xelArga Sep 10, 2025
de6f212
some python amalgamation "fixes"
xelArga Sep 10, 2025
0c5fca1
fixed some more python tests with the directed graphs
xelArga Sep 20, 2025
0bba524
makefile linking, and removing warnings of wrong datatypes in the pri…
xelArga Sep 22, 2025
72f00c1
added venv to gitignore and updated makefile for test linking
xelArga Sep 22, 2025
0653e4f
fixed seg fault in queryInterfaceBenchmark
xelArga Sep 27, 2025
3b8da74
sorted segfault in benchmarks, and moved sortData struct to sortWrapp…
xelArga Sep 29, 2025
17bf0f1
testing new worflow file for windows
xelArga Oct 5, 2025
b274ee4
Update build_run_embedDB_desktop.yml
xelArga Oct 5, 2025
27d584f
Update build_run_embedDB_desktop.yml
xelArga Oct 5, 2025
bcb4db1
updated yaml
xelArga Oct 5, 2025
0fd194d
Merge branch '150-fix-the-test_sort-failing-unit-test' of https://git…
xelArga Oct 5, 2025
d459490
updated workflow syntax error
xelArga Oct 5, 2025
8250534
updated desktop yaml
xelArga Oct 5, 2025
e2a5741
removed some prints and changed exits to return -1 instead
xelArga Oct 6, 2025
615f107
formated files with clang
xelArga Oct 6, 2025
8928a80
linted adaptive sort and extracted windows and ubuntu workflows
xelArga Oct 6, 2025
a288b62
updated workflow issue and trying to get lint to work by moving comments
xelArga Oct 6, 2025
175aaf0
updated another clang formatting error
xelArga Oct 6, 2025
316e80c
updated dist makefile, test query sort imports, amalgamation error, a…
xelArga Oct 20, 2025
691e6ea
updated faulty workflow file
xelArga Oct 20, 2025
5a40ffd
Merge branch 'main' into 150-fix-the-test_sort-failing-unit-test
xelArga Oct 20, 2025
2774958
updated clang linter
xelArga Oct 20, 2025
dfd9f61
Merge branch '150-fix-the-test_sort-failing-unit-test' of https://git…
xelArga Oct 20, 2025
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
93 changes: 60 additions & 33 deletions .github/workflows/build_embedDB_distribution_desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@ on:
branches: ["update-distribution"]

jobs:
build_platformIO:
name: Build and Run EmbedDB Distribution Using PlatformIO
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
build_platformIO_ubuntu:
name: Build and Run EmbedDB Distribution Using PlatformIO (Ubuntu)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set environment variable
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "EXPORT_COMMAND=set" >> $GITHUB_ENV
else
echo "EXPORT_COMMAND=export" >> $GITHUB_ENV
fi
shell: bash

- name: Set up Python
uses: actions/setup-python@v4

Expand All @@ -32,33 +20,72 @@ jobs:
python -m pip install --upgrade pip
python -m pip install platformio

- name: Run EmbedDB Distribution Example
- name: Run EmbedDB Example (Ubuntu)
shell: bash
run: |
pio run -e desktop-dist -t fullclean
PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=0 -lm" pio run -e desktop-dist -t exec

- name: Run EmbedDB Sequential Data Benchmark (Ubuntu)
shell: bash
run: |
pio run -e desktop-dist -t fullclean
PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=1 -lm" pio run -e desktop-dist -t exec

- name: Run EmbedDB Variable Data Benchmark (Ubuntu)
shell: bash
run: |
pio run -e desktop-dist -t fullclean
PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=2 -lm" pio run -e desktop-dist -t exec

- name: Run EmbedDB Query Interface Benchmark (Ubuntu)
shell: bash
run: |
pio run -e desktop-dist -t fullclean
${{ env.EXPORT_COMMAND }} PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=0 -lm"
pio run -e desktop-dist -t exec
pio run -e desktop-dist -t fullclean
PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=3 -lm" pio run -e desktop-dist -t exec

- name: Run EmbedDB Distribution Sequential Data Benchmark
build_platformIO_windows:
name: Build and Run EmbedDB Distribution Using PlatformIO (Windows)
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4

- name: Install PlatformIO
run: |
pio run -e desktop-dist -t fullclean
${{ env.EXPORT_COMMAND }} PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=1 -lm"
pio run -e desktop-dist -t exec
python -m pip install --upgrade pip
python -m pip install platformio

- name: Run EmbedDB Distribution Variable Data Benchmark
- name: Run EmbedDB Example (Windows)
shell: pwsh
run: |
pio run -e desktop-dist -t fullclean
${{ env.EXPORT_COMMAND }} PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=2 -lm"
pio run -e desktop-dist -t exec

- name: Run EmbedDB Distribution Query Interface Benchmark
pio run -e desktop-dist -t fullclean
$env:PLATFORMIO_BUILD_FLAGS='-DWHICH_PROGRAM=0 -lm'; pio run -e desktop-dist -t exec

- name: Run EmbedDB Sequential Data Benchmark (Windows)
shell: pwsh
run: |
pio run -e desktop-dist -t fullclean
$env:PLATFORMIO_BUILD_FLAGS='-DWHICH_PROGRAM=1 -lm'; pio run -e desktop-dist -t exec

- name: Run EmbedDB Variable Data Benchmark (Windows)
shell: pwsh
run: |
pio run -e desktop-dist -t fullclean
$env:PLATFORMIO_BUILD_FLAGS='-DWHICH_PROGRAM=2 -lm'; pio run -e desktop-dist -t exec

- name: Run EmbedDB Query Interface Benchmark (Windows)
shell: pwsh
run: |
pio run -e desktop-dist -t fullclean
${{ env.EXPORT_COMMAND }} PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=3 -lm"
pio run -e desktop-dist -t exec
pio run -e desktop-dist -t fullclean
$env:PLATFORMIO_BUILD_FLAGS='-DWHICH_PROGRAM=3 -lm'; pio run -e desktop-dist -t exec

test_platformIO:
name: Test EmbedDB Distribution using PlatformIO
needs: build_platformIO
needs: [build_platformIO_ubuntu, build_platformIO_windows]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_run_embedDB_desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Run EmbedDB Example (Ubuntu)
shell: bash
run: |
pio run -e desktop-dist -t fullclean
pio run -e desktop -t fullclean
PLATFORMIO_BUILD_FLAGS="-DWHICH_PROGRAM=0 -lm" pio run -e desktop -t exec

- name: Run EmbedDB Sequential Data Benchmark (Ubuntu)
Expand Down
7 changes: 6 additions & 1 deletion amalgamation/amalgamation.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,12 @@ def amalgamate(
sorted_h, isCpp
)

sorted_graph_c_files = [item.replace(".h", ".c") for item in sorted_graph]
sorted_graph_c_files = [
item.replace(".h", ".c")
for item in sorted_graph
if any(fn.file_name == item.replace(".h", ".c") for fn in source_file_nodes)
]

sorted_c = order_file_nodes_by_sorted_filenames(
source_file_nodes, sorted_graph_c_files
)
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DEV_TEST_OBJECTS = $(EMBEDDB_OBJECTS) $(QUERY_OBJECTS) $(EMBEDDB_FILE_INTERFACE)

TEST_FLAGS = -I. -I$(PATHU) -I $(PATHS) -I$(PATH_UTILITY) -I$(PATH_FILE_INTERFACE) -D TEST
EXAMPLE_FLAGS = -I. -I$(PATHS) -I$(PATH_UTILITY) -I$(PATH_FILE_INTERFACE) -I$(PATH_DISTRIBUTION) -DPRINT_ERRORS
TEST_DIST_FLAGS = -I. -I$(PATHU) -I$(PATH_FILE_INTERFACE) -I$(PATH_DISTRIBUTION) -DDIST -D TEST
TEST_DIST_FLAGS = -I. -I$(PATHS) -I$(PATHU) -I$(PATH_FILE_INTERFACE) -I$(PATH_DISTRIBUTION) -I$(PATH_UTILITY) -DDIST -D TEST

override CFLAGS += $(if $(filter test-dist,$(MAKECMDGOALS)), $(TEST_DIST_FLAGS), $(if $(filter test,$(MAKECMDGOALS)),$(TEST_FLAGS),$(EXAMPLE_FLAGS)) )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef DIST
#include "in_memory_sort.h"
#include "embedDB.h"
#else
#include "query-interface/sort/in_memory_sort.h"
#endif
Expand Down
118 changes: 61 additions & 57 deletions test/test_sort/test_sort_query_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "embedDB/embedDB.h"
#ifdef DIST
#include "embedDB.h"
#else
#include "embedDBUtility.h"
#include "unity.h"
#include "query-interface/advancedQueries.h"

#endif

#ifdef ARDUINO
// For Arduino, setupFile is not used since we use pure memory sort
Expand Down Expand Up @@ -48,23 +52,71 @@ void* setupFile(const char* filename) {
#define DATA_FILE_PATH_SEA "dataFileSEA.bin"
#define INDEX_FILE_PATH_SEA "indexFileSEA.bin"

#include "query-interface/advancedQueries.h"

#else

#include "desktopFileInterface.h"
#include "query-interface/advancedQueries.h"
#define FILE_TYPE FILE
#include "desktopFileInterface.h"
#define DATA_FILE_PATH_UWA "build/artifacts/dataFileUWA.bin"
#define INDEX_FILE_PATH_UWA "build/artifacts/indexFileUWA.bin"
#define DATA_FILE_PATH_SEA "build/artifacts/dataFileSEA.bin"
#define INDEX_FILE_PATH_SEA "build/artifacts/indexFileSEA.bin"

#endif

void setUp() {}
#include "unity.h"

embedDBState* stateUWA;
embedDBSchema* baseSchema;

void setUp() {
if (STORAGE_TYPE == 1) {
TEST_FAIL_MESSAGE("Dataflash is not currently supported. Defaulting to SD card interface.");
}
stateUWA = (embedDBState*)malloc(sizeof(embedDBState));
stateUWA->keySize = 4;
stateUWA->dataSize = 12;
stateUWA->compareKey = int32Comparator;
stateUWA->compareData = int32Comparator;
stateUWA->pageSize = 512;
stateUWA->eraseSizeInPages = 4;
stateUWA->numDataPages = 20000;
stateUWA->numIndexPages = 1000;
stateUWA->numSplinePoints = 30;
/* Setup files */
char dataPath[] = DATA_FILE_PATH_UWA, indexPath[] = INDEX_FILE_PATH_UWA;
stateUWA->fileInterface = getFileInterface();
stateUWA->dataFile = setupFile(dataPath);
stateUWA->indexFile = setupFile(indexPath);

stateUWA->bufferSizeInBlocks = 4;
stateUWA->buffer = malloc(stateUWA->bufferSizeInBlocks * stateUWA->pageSize);
stateUWA->parameters = EMBEDDB_USE_BMAP | EMBEDDB_USE_INDEX | EMBEDDB_RESET_DATA;
stateUWA->bitmapSize = 2;
stateUWA->inBitmap = inBitmapInt16;
stateUWA->updateBitmap = updateBitmapInt16;
stateUWA->buildBitmapFromRange = buildBitmapInt16FromRange;
int8_t initResult = embedDBInit(stateUWA, 1);
if (initResult != 0) {
TEST_FAIL_MESSAGE("There was an error setting up the state of the UWA dataset.");
}
stateUWA->rules = NULL;
stateUWA->numRules = 0;

int8_t colSizes[] = {4, 12};
int8_t colSignedness[] = {embedDB_COLUMN_UNSIGNED, embedDB_COLUMN_UNSIGNED};
ColumnType colTypes[] = {embedDB_COLUMN_UINT32, embedDB_COLUMN_UINT32};
baseSchema = embedDBCreateSchema(2, colSizes, colSignedness, colTypes);
}

void tearDown() {}
void tearDown() {
embedDBClose(stateUWA);
tearDownFile(stateUWA->dataFile);
tearDownFile(stateUWA->indexFile);
free(stateUWA->fileInterface);
free(stateUWA->buffer);
free(stateUWA);
embedDBFreeSchema(&baseSchema);
}

void insertData(embedDBState* state, const char* filename) {
FILE_TYPE* fp = fopen(filename, "rb");
Expand Down Expand Up @@ -107,45 +159,7 @@ void insertNValues(embedDBState* state, int n, int mode) {
}

void runTestSequentialValues() {
if (STORAGE_TYPE == 1) {
TEST_FAIL_MESSAGE("Dataflash is not currently supported. Defaulting to SD card interface.");
}
embedDBState* stateUWA = (embedDBState*)malloc(sizeof(embedDBState));
stateUWA->keySize = 4;
stateUWA->dataSize = 12;
stateUWA->compareKey = int32Comparator;
stateUWA->compareData = int32Comparator;
stateUWA->pageSize = 512;
stateUWA->eraseSizeInPages = 4;
stateUWA->numDataPages = 20000;
stateUWA->numIndexPages = 1000;
stateUWA->numSplinePoints = 30;
/* Setup files */
char dataPath[] = DATA_FILE_PATH_UWA, indexPath[] = INDEX_FILE_PATH_UWA;
stateUWA->fileInterface = getFileInterface();
stateUWA->dataFile = setupFile(dataPath);
stateUWA->indexFile = setupFile(indexPath);

stateUWA->bufferSizeInBlocks = 4;
stateUWA->buffer = malloc(stateUWA->bufferSizeInBlocks * stateUWA->pageSize);
stateUWA->parameters = EMBEDDB_USE_BMAP | EMBEDDB_USE_INDEX | EMBEDDB_RESET_DATA;
stateUWA->bitmapSize = 2;
stateUWA->inBitmap = inBitmapInt16;
stateUWA->updateBitmap = updateBitmapInt16;
stateUWA->buildBitmapFromRange = buildBitmapInt16FromRange;
int8_t initResult = embedDBInit(stateUWA, 1);
if (initResult != 0) {
TEST_FAIL_MESSAGE("There was an error setting up the state of the UWA dataset.");
}
stateUWA->rules = NULL;
stateUWA->numRules = 0;

int8_t colSizes[] = {4, 12};
int8_t colSignedness[] = {embedDB_COLUMN_UNSIGNED, embedDB_COLUMN_UNSIGNED};
ColumnType colTypes[] = {embedDB_COLUMN_UINT32, embedDB_COLUMN_UINT32};
embedDBSchema* baseSchema = embedDBCreateSchema(2, colSizes, colSignedness, colTypes);

// Insert test data
// Insert test data
#ifdef ARDUINO
insertNValues(stateUWA, 1, 0);
#else
Expand Down Expand Up @@ -183,15 +197,6 @@ void runTestSequentialValues() {

orderByOp->close(orderByOp);
embedDBFreeOperatorRecursive(&orderByOp);

// Close embedDB
embedDBClose(stateUWA);
tearDownFile(stateUWA->dataFile);
tearDownFile(stateUWA->indexFile);
free(stateUWA->fileInterface);
free(stateUWA->buffer);
free(stateUWA);
embedDBFreeSchema(&baseSchema);
}

void runTestUsingUWA500k() {
Expand Down Expand Up @@ -261,7 +266,6 @@ void runTestUsingUWA500k() {

orderByOp->close(orderByOp);
embedDBFreeOperatorRecursive(&orderByOp);

// Close embedDB
embedDBClose(stateUWA);
tearDownFile(stateUWA->dataFile);
Expand Down
Loading