Skip to content

Commit

Permalink
remove matrix test, replace with individual targets for better cacheing
Browse files Browse the repository at this point in the history
  • Loading branch information
driftregion committed Dec 10, 2023
1 parent 4b327a4 commit 1268778
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 76 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ genrule(
name = "isotp_c_wrapped_c",
srcs = glob(["src/tp/isotp-c/*.c"]),
outs = ["isotp_c_wrapped.c"],
cmd = "echo '#if defined(UDS_TP) && UDS_TP==UDS_TP_ISOTP_C' >> $(OUTS) ; for f in $(SRCS); do cat $$f >> $(OUTS); done ; echo '#endif' >> $(OUTS)",
cmd = "echo '#if defined(UDS_ISOTP_C)' >> $(OUTS) ; for f in $(SRCS); do cat $$f >> $(OUTS); done ; echo '#endif' >> $(OUTS)",
)

genrule(
name = "isotp_c_wrapped_h",
srcs = glob(["src/tp/isotp-c/*.h"]),
outs = ["isotp_c_wrapped.h"],
cmd = "echo '#if defined(UDS_TP) && UDS_TP==UDS_TP_ISOTP_C' >> $(OUTS) ; for f in $(SRCS); do cat $$f >> $(OUTS); done ; echo '#endif' >> $(OUTS)",
cmd = "echo '#if defined(UDS_ISOTP_C)' >> $(OUTS) ; for f in $(SRCS); do cat $$f >> $(OUTS); done ; echo '#endif' >> $(OUTS)",
)

genrule(
Expand Down
10 changes: 6 additions & 4 deletions src/sys_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

#if UDS_SYS==UDS_SYS_UNIX

#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>

#endif
29 changes: 2 additions & 27 deletions src/tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,9 @@

#include "sys.h"

#if !defined(UDS_TP)
#if (UDS_SYS == UDS_SYS_UNIX)
#define UDS_TP UDS_TP_ISOTP_SOCKET
#if defined(UDS_TP_ISOTP_C) || defined(UDS_TP_ISOTP_C_SOCKETCAN)
#define UDS_ISOTP_C
#endif
#endif

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>

#if (UDS_TP == UDS_TP_ISOTP_C)
#include "tp/isotp-c/isotp.h"
#include "tp/isotp-c/isotp_config.h"
#include "tp/isotp-c/isotp_defines.h"
#elif (UDS_TP == UDS_TP_ISOTP_SOCKET)
#include <errno.h>
#include <linux/can.h>
#include <linux/can/isotp.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#endif


enum UDSTpStatusFlags {
UDS_TP_IDLE = 0x00000000,
Expand Down
4 changes: 1 addition & 3 deletions src/tp/isotp_c.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

#include <stdint.h>
#if UDS_TP == UDS_TP_ISOTP_C
#if defined(UDS_TP_ISOTP_C)

#include "util.h"
#include "tp/isotp_c.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tp/isotp_c.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#if UDS_TP == UDS_TP_ISOTP_C
#if defined(UDS_TP_ISOTP_C)

#include "sys.h"
#include "config.h"
Expand Down
6 changes: 3 additions & 3 deletions src/tp/isotp_c_socketcan.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "iso14229.h"
#include "tp/isotp-c/isotp.h"

#if defined(UDS_TP_ISOTP_C_SOCKETCAN)

#include "tp.h"
#include "tp/isotp-c/isotp.h"

typedef struct {
UDSTpHandle_t hdl;
IsoTpLink phys_link;
Expand Down
47 changes: 28 additions & 19 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,40 @@ TEST_NAMES = [ src.split(".c")[0] for src in TEST_SRCS ]
# These should pass on all architectures and transports
[
cc_test(
name=name,
name=name + "_tp_mock",
srcs=[src],
deps=[":env"],
size = "small",
env = {
"UDS_TP_TYPE": "0",
},
env = { "UDS_TP_TYPE": "0", },
copts = ["-g"],
tags = [
"exclusive",
],
)
for name, src in zip(TEST_NAMES, TEST_SRCS)
tags = [ "exclusive", ],
) for name, src in zip(TEST_NAMES, TEST_SRCS)
]

[
cc_test(
name=name + "_tp_sock",
srcs=[src],
deps=[":env"],
size = "small",
env = { "UDS_TP_TYPE": "1"},
copts = ["-g"],
tags = [ "exclusive", ],
) for name, src in zip(TEST_NAMES, TEST_SRCS)
]

[
cc_test(
name=name + "_tp_c",
srcs=[src],
deps=[":env"],
size = "small",
env = { "UDS_TP_TYPE": "2"},
copts = ["-g"],
tags = [ "exclusive", ],
) for name, src in zip(TEST_NAMES, TEST_SRCS)
]

py_test(
name = "test_matrix",
srcs = ["test_matrix.py"],
size = "small",
data = TEST_NAMES,
args = TEST_NAMES,
tags = [
"exclusive",
],
)

cc_test(
name = "test_fuzz_server",
Expand Down
17 changes: 0 additions & 17 deletions test/test_matrix.py

This file was deleted.

0 comments on commit 1268778

Please sign in to comment.