-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.cache | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "acquire-core-libs"] | ||
path = acquire-core-libs | ||
url = ../acquire-core-libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(driver-tester) | ||
|
||
set(NOTEST "TRUE") | ||
add_subdirectory(acquire-core-libs) | ||
set(NOTEST "FALSE") | ||
|
||
add_subdirectory(src) |
Submodule acquire-core-libs
added at
edb33c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(tgt aq_drv_tester) | ||
add_executable(${tgt} main.c) | ||
target_link_libraries(${tgt} acquire-core-platform acquire-device-kit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "platform.h" | ||
#include <printf.h> | ||
|
||
#define L(lvl, file, line, func, ...) (printf(__VA_ARGS__)) | ||
#define LOG(...) L(0, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) | ||
#define LOGE(...) L(1, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) | ||
#define EXPECT(e, ...) \ | ||
do { \ | ||
if (!(e)) { \ | ||
LOGE(__VA_ARGS__); \ | ||
goto Error; \ | ||
} \ | ||
} while (0) | ||
#define CHECK(e) EXPECT(e, "Expression evaluated as false:\n\t%s", #e) | ||
|
||
void reporter(int is_error, const char *file, int line, const char *function, | ||
const char *msg) { | ||
printf("%5s: %s:%d - %s", is_error ? "Error" : "", file, line, function, msg); | ||
} | ||
|
||
typedef struct Driver *(*acquire_driver_init_v0)( | ||
void (*reporter)(int is_error, const char *file, int line, | ||
const char *function, const char *msg)); | ||
|
||
int main(int argc, char *argv[]) { | ||
struct lib lib = {}; | ||
CHECK(lib_open_by_name(&lib, "acquire-driver-pvcam")); | ||
lib_load(&lib, "acquire_driver_init_v0"); | ||
Error: | ||
return 1; | ||
} |