diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 3c95d8055b..e00be7958e 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -180,8 +180,7 @@ jobs: $PYTEST --timeout 30 -m 'not slow' && \ ./selfdrive/ui/tests/create_test_translations.sh && \ QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \ - ./selfdrive/ui/tests/test_translations.py && \ - ./system/camerad/test/ae_gray_test" + ./selfdrive/ui/tests/test_translations.py" - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v3 with: diff --git a/pyproject.toml b/pyproject.toml index 2fec88f244..da027ae95b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ testpaths = [ "selfdrive/thermald", "selfdrive/test/longitudinal_maneuvers", "selfdrive/test/process_replay/test_fuzzy.py", + "system/camerad", "system/hardware/tici", "system/loggerd", "system/proclogd", diff --git a/system/camerad/SConscript b/system/camerad/SConscript index 60a8f261e5..8f19e7ee19 100644 --- a/system/camerad/SConscript +++ b/system/camerad/SConscript @@ -7,4 +7,4 @@ camera_obj = env.Object(['cameras/camera_qcom2.cc', 'cameras/camera_common.cc', env.Program('camerad', ['main.cc', camera_obj], LIBS=libs) if GetOption("extras") and arch == "x86_64": - env.Program('test/ae_gray_test', ['test/ae_gray_test.cc', camera_obj], LIBS=libs) + env.Program('test/test_ae_gray', ['test/test_ae_gray.cc', camera_obj], LIBS=libs) diff --git a/system/camerad/test/.gitignore b/system/camerad/test/.gitignore index 44cd0b2730..d67473ebcd 100644 --- a/system/camerad/test/.gitignore +++ b/system/camerad/test/.gitignore @@ -1 +1,2 @@ jpegs/ +test_ae_gray diff --git a/system/camerad/test/ae_gray_test.h b/system/camerad/test/ae_gray_test.h deleted file mode 100644 index 8953fb017f..0000000000 --- a/system/camerad/test/ae_gray_test.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#define W 240 -#define H 160 - -#define TONE_SPLITS 3 - -float gts[TONE_SPLITS * TONE_SPLITS * TONE_SPLITS * TONE_SPLITS] = { - 0.917969, 0.917969, 0.375000, 0.917969, 0.375000, 0.375000, 0.187500, 0.187500, 0.187500, 0.917969, - 0.375000, 0.375000, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.093750, 0.093750, - 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.917969, 0.375000, 0.375000, - 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.093750, 0.093750, 0.093750, 0.093750, - 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, - 0.093750, 0.093750, 0.093750, 0.093750, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, - 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, - 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, - 0.000000}; diff --git a/system/camerad/test/ae_gray_test.cc b/system/camerad/test/test_ae_gray.cc similarity index 63% rename from system/camerad/test/ae_gray_test.cc rename to system/camerad/test/test_ae_gray.cc index 8d18f7e93b..06d784927a 100644 --- a/system/camerad/test/ae_gray_test.cc +++ b/system/camerad/test/test_ae_gray.cc @@ -1,6 +1,5 @@ -// unittest for set_exposure_target - -#include "system/camerad/test/ae_gray_test.h" +#define CATCH_CONFIG_MAIN +#include "catch2/catch.hpp" #include @@ -10,7 +9,25 @@ #include "common/util.h" #include "system/camerad/cameras/camera_common.h" -int main() { +#define W 240 +#define H 160 + + +#define TONE_SPLITS 3 + +float gts[TONE_SPLITS * TONE_SPLITS * TONE_SPLITS * TONE_SPLITS] = { + 0.917969, 0.917969, 0.375000, 0.917969, 0.375000, 0.375000, 0.187500, 0.187500, 0.187500, 0.917969, + 0.375000, 0.375000, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.093750, 0.093750, + 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.917969, 0.375000, 0.375000, + 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.187500, 0.093750, 0.093750, 0.093750, 0.093750, + 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, 0.093750, + 0.093750, 0.093750, 0.093750, 0.093750, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, + 0.000000}; + + +TEST_CASE("camera.test_set_exposure_target") { // set up fake camerabuf CameraBuf cb = {}; VisionBuf vb = {}; @@ -63,5 +80,4 @@ int main() { assert(passed); delete[] fb_y; - return 0; }