Skip to content
Merged
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
24 changes: 11 additions & 13 deletions .github/workflows/meson_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- "**.h"
- "**.cpp"
- "**.hpp"
- "**.rs"
- "**.py"
- "**.build"
- "**.options"
Expand All @@ -17,7 +16,6 @@ on:
- "**.h"
- "**.cpp"
- "**.hpp"
- "**.rs"
- "**.py"
- "**.build"
- "**.options"
Expand Down Expand Up @@ -249,7 +247,7 @@ jobs:
-w /workspace \
${GITHUB_REPOSITORY}:${{ matrix.distro }} \
/bin/bash -c "
apt-get update
sudo apt update
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
meson compile -C builddir
meson test -C builddir -v"
Expand All @@ -275,25 +273,25 @@ jobs:

- name: Install Cross-Compilation Toolchain
run: |
sudo apt-get update
sudo apt update
if [ "${{ matrix.architecture }}" == "arm" ]; then
sudo apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
elif [ "${{ matrix.architecture }}" == "mips" ]; then
sudo apt-get install -y gcc-mips-linux-gnu g++-mips-linux-gnu
sudo apt install -y gcc-mips-linux-gnu g++-mips-linux-gnu
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
sudo apt-get install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
sudo apt install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
sudo apt-get install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
sudo apt install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
sudo apt-get install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
sudo apt install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
sudo apt-get install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
sudo apt install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
sudo apt-get install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
sudo apt install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
sudo apt-get install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
sudo apt install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
fi

- name: Set Cross-Compilation Environment Variables
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive \
TZ=UTC

# Install system dependencies and clean up
RUN apt-get update && \
apt-get install -y \
RUN apt update && \
apt install -y \
build-essential \
gcc \
g++ \
gdb \
libstdc++-10-dev \
rustc \
cargo \
wget \
python3 \
python3-pip \
Expand Down
60 changes: 30 additions & 30 deletions code/logic/fossil/test/marking.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,83 +41,83 @@ typedef struct {
double min_duration;
double max_duration;
int running;
} fossil_benchmark_t;
} fossil_mark_t;

/**
* @brief Initializes a fossil_benchmark_t object with the given name.
* @param benchmark The fossil_benchmark_t object to initialize.
* @brief Initializes a fossil_mark_t object with the given name.
* @param benchmark The fossil_mark_t object to initialize.
* @param name The name of the benchmark.
*/
void fossil_benchmark_init(fossil_benchmark_t* benchmark, const char* name);
void fossil_benchmark_init(fossil_mark_t* benchmark, const char* name);

/**
* @brief Starts the benchmark timer.
* @param benchmark The fossil_benchmark_t object to start.
* @param benchmark The fossil_mark_t object to start.
*/
void fossil_benchmark_start(fossil_benchmark_t* benchmark);
void fossil_benchmark_start(fossil_mark_t* benchmark);

/**
* @brief Stops the benchmark timer.
* @param benchmark The fossil_benchmark_t object to stop.
* @param benchmark The fossil_mark_t object to stop.
*/
void fossil_benchmark_stop(fossil_benchmark_t* benchmark);
void fossil_benchmark_stop(fossil_mark_t* benchmark);

/**
* @brief Returns the total elapsed time in seconds.
* @param benchmark The fossil_benchmark_t object to get the elapsed time from.
* @param benchmark The fossil_mark_t object to get the elapsed time from.
* @return The total elapsed time in seconds.
*/
double fossil_benchmark_elapsed_seconds(const fossil_benchmark_t* benchmark);
double fossil_benchmark_elapsed_seconds(const fossil_mark_t* benchmark);

/**
* @brief Returns the minimum elapsed time in seconds.
* @param benchmark The fossil_benchmark_t object to get the minimum time from.
* @param benchmark The fossil_mark_t object to get the minimum time from.
* @return The minimum elapsed time in seconds.
*/
double fossil_benchmark_min_time(const fossil_benchmark_t* benchmark);
double fossil_benchmark_min_time(const fossil_mark_t* benchmark);

/**
* @brief Returns the maximum elapsed time in seconds.
* @param benchmark The fossil_benchmark_t object to get the maximum time from.
* @param benchmark The fossil_mark_t object to get the maximum time from.
* @return The maximum elapsed time in seconds.
*/
double fossil_benchmark_max_time(const fossil_benchmark_t* benchmark);
double fossil_benchmark_max_time(const fossil_mark_t* benchmark);

/**
* @brief Returns the average elapsed time in seconds.
* @param benchmark The fossil_benchmark_t object to get the average time from.
* @param benchmark The fossil_mark_t object to get the average time from.
* @return The average elapsed time in seconds.
*/
double fossil_benchmark_avg_time(const fossil_benchmark_t* benchmark);
double fossil_benchmark_avg_time(const fossil_mark_t* benchmark);

/**
* @brief Resets the benchmark statistics.
* @param benchmark The fossil_benchmark_t object to reset.
* @param benchmark The fossil_mark_t object to reset.
*/
void fossil_benchmark_reset(fossil_benchmark_t* benchmark);
void fossil_benchmark_reset(fossil_mark_t* benchmark);

/**
* @brief Prints a report of the benchmark statistics.
* @param benchmark The fossil_benchmark_t object to report.
* @param benchmark The fossil_mark_t object to report.
*/
void fossil_benchmark_report(const fossil_benchmark_t* benchmark);
void fossil_benchmark_report(const fossil_mark_t* benchmark);

typedef struct {
fossil_benchmark_t* benchmark;
} scoped_benchmark_t;
fossil_mark_t* benchmark;
} fossil_scoped_mark_t;

/**
* @brief Initializes a scoped_benchmark_t object with the given benchmark.
* @param scoped_benchmark The scoped_benchmark_t object to initialize.
* @brief Initializes a fossil_scoped_mark_t object with the given benchmark.
* @param scoped_benchmark The fossil_scoped_mark_t object to initialize.
* @param benchmark The benchmark to be scoped.
*/
void fossil_scoped_benchmark_init(scoped_benchmark_t* scoped_benchmark, fossil_benchmark_t* benchmark);
void fossil_scoped_benchmark_init(fossil_scoped_mark_t* scoped_benchmark, fossil_mark_t* benchmark);

/**
* @brief Destroys a scoped_benchmark_t object.
* @param scoped_benchmark The scoped_benchmark_t object to destroy.
* @brief Destroys a fossil_scoped_mark_t object.
* @param scoped_benchmark The fossil_scoped_mark_t object to destroy.
*/
void fossil_scoped_benchmark_destroy(scoped_benchmark_t* scoped_benchmark);
void fossil_scoped_benchmark_destroy(fossil_scoped_mark_t* scoped_benchmark);

/**
* Function to test benchmark with specified duration type, expected value, and actual value.
Expand Down Expand Up @@ -153,7 +153,7 @@ uint64_t fossil_test_stop_benchmark(void);
* @param name The name of the benchmark.
*/
#define _MARK_BENCHMARK(name) \
fossil_benchmark_t benchmark_##name; \
fossil_mark_t benchmark_##name; \
fossil_benchmark_init(&benchmark_##name, #name)

/**
Expand Down Expand Up @@ -199,7 +199,7 @@ uint64_t fossil_test_stop_benchmark(void);
* @param name The name of the benchmark.
*/
#define _MARK_SCOPED(name) \
scoped_benchmark_t scoped_benchmark_##name; \
fossil_scoped_mark_t scoped_benchmark_##name; \
fossil_scoped_benchmark_init(&scoped_benchmark_##name, &benchmark_##name)

// =================================================================
Expand Down
36 changes: 18 additions & 18 deletions code/logic/fossil/test/mocking.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,49 +118,49 @@ extern "C" {

// C interface

typedef struct MockCall {
typedef struct fossil_mock_call_t {
char *function_name;
char **arguments;
int num_args;
struct MockCall *next;
} MockCall;
struct fossil_mock_call_t *next;
} fossil_mock_call_t;

typedef struct {
MockCall *head;
MockCall *tail;
fossil_mock_call_t *head;
fossil_mock_call_t *tail;
int size;
} MockCallList;
} fossil_mock_calllist_t;

/**
* Initializes a MockCallList.
* Initializes a fossil_mock_calllist_t.
*
* @param list The MockCallList to initialize.
* @param list The fossil_mock_calllist_t to initialize.
*/
void fossil_mock_init(MockCallList *list);
void fossil_mock_init(fossil_mock_calllist_t *list);

/**
* Destroys a MockCallList and frees all associated memory.
* Destroys a fossil_mock_calllist_t and frees all associated memory.
*
* @param list The MockCallList to destroy.
* @param list The fossil_mock_calllist_t to destroy.
*/
void fossil_mock_destroy(MockCallList *list);
void fossil_mock_destroy(fossil_mock_calllist_t *list);

/**
* Adds a MockCall to the MockCallList.
* Adds a fossil_mock_call_t to the fossil_mock_calllist_t.
*
* @param list The MockCallList to add the MockCall to.
* @param list The fossil_mock_calllist_t to add the fossil_mock_call_t to.
* @param function_name The name of the function being called.
* @param arguments The arguments passed to the function.
* @param num_args The number of arguments.
*/
void fossil_mock_add_call(MockCallList *list, const char *function_name, char **arguments, int num_args);
void fossil_mock_add_call(fossil_mock_calllist_t *list, const char *function_name, char **arguments, int num_args);

/**
* Prints the contents of a MockCallList.
* Prints the contents of a fossil_mock_calllist_t.
*
* @param list The MockCallList to print.
* @param list The fossil_mock_calllist_t to print.
*/
void fossil_mock_print(MockCallList *list);
void fossil_mock_print(fossil_mock_calllist_t *list);

#ifdef __cplusplus
}
Expand Down
Loading
Loading