Skip to content

Commit

Permalink
build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yezzfusl authored Jul 31, 2024
1 parent 4724fac commit 8799d61
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,3 @@ jobs:
- name: Build project
run: make

- name: Run mock test
run: |
# Create a mock CAN data file
echo "0 123 8 DE AD BE EF 00 00 00 00" > mock_can_data.log
echo "1 456 8 01 23 45 67 89 AB CD EF" >> mock_can_data.log
# Modify CAN Analyzer to read from file instead of CAN interface
sed -i 's/can_receive(socket_fd, &frame)/read_mock_can_data("mock_can_data.log", &frame)/' src/main.c
# Add mock function to main.c
echo "
#include <stdio.h>
int read_mock_can_data(const char* filename, struct can_frame *frame);
int read_mock_can_data(const char* filename, struct can_frame *frame) {
static FILE *file = NULL;
if (!file) file = fopen(filename, \"r\");
if (!file) return -1;
unsigned int id;
int dlc;
if (fscanf(file, \"%*d %x %d\", &id, &dlc) != 2) {
fclose(file);
file = NULL;
return -1;
}
frame->can_id = id;
frame->can_dlc = dlc;
for (int i = 0; i < dlc; i++) {
unsigned int byte;
fscanf(file, \"%x\", &byte);
frame->data[i] = byte;
}
return 0;
}" >> src/main.c
# Rebuild the project
make
# Run CAN Analyzer with mock data
./can_analyzer mock &
CAN_PID=$!
# Wait for a moment to allow processing
sleep 5
# Kill CAN Analyzer
kill $CAN_PID
# Check if graph was generated
if [ -f can_data.png ]; then
echo "Graph generated successfully"
else
echo "Graph generation failed"
exit 1
fi
- name: Upload graph artifact
uses: actions/upload-artifact@v2
with:
name: can-data-graph
path: can_data.png

0 comments on commit 8799d61

Please sign in to comment.