summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Expand)Author
2024-09-11qcam: Decrease minimum width of selector dialogLuca Weiss
2024-09-10v4l2: Support setting frame rate in the V4L2 Adaptation layerNejc Galof
2024-09-09ipa: rpi: agc: Ignore stable region when exposure/gain set manuallyDavid Plowman
2024-09-05pipeline: rkisp1: Use ScopeExitActions to simplify error handling in startLaurent Pinchart
2024-09-05libcamera: utils: Add ScopeExitActions classLaurent Pinchart
2024-09-03libcamera: ipa: Drop unneded includes from ipa_interface.hLaurent Pinchart
2024-09-02libcamera: libcamera: Formatting improvementsMilan Zamazal
2024-09-02libcamera: libcamera: Add missing includesMilan Zamazal
2024-09-02libcamera: libcamera: Remove unused includesMilan Zamazal
2024-09-02libcamera: v4l2: Fix indirect includeMilan Zamazal
2024-09-02libcamera: v4l2: Fix an include placementMilan Zamazal
2024-09-02libcamera: v4l2: Remove unused includesMilan Zamazal
2024-09-02libcamera: uvcvideo: Fix includesMilan Zamazal
2024-09-02libcamera: libipa: Remove unused includesMilan Zamazal
2024-09-02libcamera: rkisp1: Formatting improvementsMilan Zamazal
2024-09-02libcamera: rkisp1: Remove unused includesMilan Zamazal
2024-09-02libcamera: ipu3: Formatting improvementsMilan Zamazal
2024-09-02libcamera: ipu3: Replace wrong includeMilan Zamazal
2024-09-02libcamera: ipu3: Remove unused includesMilan Zamazal
2024-08-30pipeline: uvcvideo: Implement acquireDevice() + releaseDevice()Hans de Goede
2024-08-30libcamera: camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()Hans de Goede
2024-08-30pipeline_handler: Add acquireDevice() function to mirror releaseDevice()Hans de Goede
2024-08-27ipa: rkisp1: blc: Add support for BLS in compandPaul Elder
2024-08-27ipa: rkisp1: Add compand feature flag to ipa contextPaul Elder
2024-08-27ipa: rkisp1: params: Add companding blocksLaurent Pinchart
2024-08-27pipeline: rkisp1: Use the extensible parameters formatJacopo Mondi
2024-08-27ipa: rkisp1: Use the new ISP parameters abstractionLaurent Pinchart
2024-08-27ipa: rkisp1: Add ISP parameters abstraction classLaurent Pinchart
2024-08-27ipa: rkisp1: Pass parameters buffer size to pipeline handlerJacopo Mondi
2024-08-27ipa: rkisp1: Pass parameters buffer format to IPA moduleLaurent Pinchart
2024-08-25libcamera: controls: Fix example for ExposureValueFang Hui
2024-08-25libcamera: pipeline_handler: Call releaseDevice() before unlocking media devicesHans de Goede
2024-08-25libcamera: pipeline_handler: Fix unlocking media devices too earlyHans de Goede
2024-08-16libcamera: controls: Improve formatting of control descriptions in YAMLLaurent Pinchart
2024-08-16py: gen-py-controls: Convert to jinja2 templatesLaurent Pinchart
2024-08-16py: gen-py-controls: Use Control classLaurent Pinchart
2024-08-16utils: codegen: gen-controls.py: Move helper classes to separate fileLaurent Pinchart
2024-08-16utils: codegen: gen-controls.py: Convert to jinja2 templatesLaurent Pinchart
2024-08-16meson: utils: Provide environment for Python scriptsLaurent Pinchart
2024-08-15libcamera: Drop remaining file names from header comment blocksLaurent Pinchart
2024-08-15meson: Fix mismatch in controls and properties generated file namesLaurent Pinchart
2024-08-15meson: Store controls and properties YAML files in variablesLaurent Pinchart
2024-08-14libcamera: camera: Hide Camera::create() from the public APILaurent Pinchart
2024-08-14Documentation: Split public/private documentationDaniel Scally
2024-08-14Documentation: Add Thread safety pageDaniel Scally
2024-08-12py: cam: Convert to PyQt6Tomi Valkeinen
2024-08-12libcamera: simple: Fix a typo in a doc stringMilan Zamazal
2024-08-12ipa: libipa: Add missing CameraSensorHelper fn label in docsMilan Zamazal
2024-08-12libcamera: formats: Adding Support for Y12Pwill whang
2024-08-12libcamera: Fix header groupingLaurent Pinchart
sing namespace libcamera; class FileTest : public Test { protected: int init() { fileName_ = "/tmp/libcamera.test.XXXXXX"; int fd = mkstemp(&fileName_.front()); if (fd == -1) return TestFail; close(fd); unlink(fileName_.c_str()); return TestPass; } int run() { /* Test static functions. */ if (!File::exists("/dev/null")) { cerr << "Valid file not found" << endl; return TestFail; } if (File::exists("/dev/null/invalid")) { cerr << "Invalid file should not exist" << endl; return TestFail; } if (File::exists("/dev")) { cerr << "Directories should not be treated as files" << endl; return TestFail; } /* Test unnamed file. */ File file; if (!file.fileName().empty()) { cerr << "Unnamed file has non-empty file name" << endl; return TestFail; } if (file.exists()) { cerr << "Unnamed file exists" << endl; return TestFail; } if (file.isOpen()) { cerr << "File is open after construction" << endl; return TestFail; } if (file.openMode() != File::OpenModeFlag::NotOpen) { cerr << "File has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Unnamed file has a size" << endl; return TestFail; } if (file.open(File::OpenModeFlag::ReadWrite)) { cerr << "Opening unnamed file succeeded" << endl; return TestFail; } if (file.error() == 0) { cerr << "Open failure didn't set error" << endl; return TestFail; } /* Test named file referring to an invalid file. */ file.setFileName("/dev/null/invalid"); if (file.fileName() != "/dev/null/invalid") { cerr << "File reports incorrect file name" << endl; return TestFail; } if (file.exists()) { cerr << "Invalid file exists" << endl; return TestFail; } if (file.isOpen()) { cerr << "Invalid file is open after construction" << endl; return TestFail; } if (file.openMode() != File::OpenModeFlag::NotOpen) { cerr << "Invalid file has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Invalid file has a size" << endl; return TestFail; } if (file.open(File::OpenModeFlag::ReadWrite)) { cerr << "Opening invalid file succeeded" << endl; return TestFail; } /* Test named file referring to a valid file. */ file.setFileName("/dev/null"); if (!file.exists()) { cerr << "Valid file does not exist" << endl; return TestFail; } if (file.isOpen()) { cerr << "Valid file is open after construction" << endl; return TestFail; } if (file.openMode() != File::OpenModeFlag::NotOpen) { cerr << "Valid file has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Invalid file has a size" << endl; return TestFail; } /* Test open and close. */ if (!file.open(File::OpenModeFlag::ReadWrite)) { cerr << "Opening file failed" << endl; return TestFail; } if (!file.isOpen()) { cerr << "Open file reported as closed" << endl; return TestFail; } if (file.openMode() != File::OpenModeFlag::ReadWrite) { cerr << "Open file has invalid open mode" << endl; return TestFail; } file.close(); if (file.isOpen()) { cerr << "Closed file reported as open" << endl; return TestFail; } if (file.openMode() != File::OpenModeFlag::NotOpen) { cerr << "Closed file has invalid open mode" << endl; return TestFail; } /* Test size(). */ file.setFileName(self()); if (file.size() >= 0) { cerr << "File has valid size before open" << endl; return TestFail; } file.open(File::OpenModeFlag::ReadOnly); ssize_t size = file.size(); if (size <= 0) { cerr << "File has invalid size after open" << endl; return TestFail; } file.close(); /* Test file creation. */ file.setFileName(fileName_); if (file.exists()) { cerr << "Temporary file already exists" << endl; return TestFail; } if (file.open(File::OpenModeFlag::ReadOnly)) { cerr << "Read-only open succeeded on nonexistent file" << endl; return TestFail; } if (!file.open(File::OpenModeFlag::WriteOnly)) { cerr << "Write-only open failed on nonexistent file" << endl; return TestFail; } if (!file.exists()) { cerr << "Write-only open failed to create file" << endl; return TestFail; } file.close(); /* Test read and write. */ std::array<uint8_t, 256> buffer = { 0 }; strncpy(reinterpret_cast<char *>(buffer.data()), "libcamera", buffer.size()); if (file.read(buffer) >= 0) { cerr << "Read succeeded on closed file" << endl; return TestFail; } if (file.write(buffer) >= 0) { cerr << "Write succeeded on closed file" << endl; return TestFail; } file.open(File::OpenModeFlag::ReadOnly); if (file.write(buffer) >= 0) { cerr << "Write succeeded on read-only file" << endl; return TestFail; } file.close(); file.open(File::OpenModeFlag::ReadWrite); if (file.write({ buffer.data(), 9 }) != 9) { cerr << "Write test failed" << endl; return TestFail; } if (file.read(buffer) != 0) { cerr << "Read at end of file test failed" << endl; return TestFail; } if (file.seek(0) != 0) { cerr << "Seek test failed" << endl; return TestFail; } if (file.read(buffer) != 9) { cerr << "Read test failed" << endl; return TestFail; } if (file.pos() != 9) { cerr << "Position test failed" << endl; return TestFail; } file.close(); /* Test mapping and unmapping. */ file.setFileName(self()); file.open(File::OpenModeFlag::ReadOnly); Span<uint8_t> data = file.map(); if (data.empty()) { cerr << "Mapping of complete file failed" << endl; return TestFail; } if (data.size() != static_cast<size_t>(size)) { cerr << "Mapping of complete file has invalid size" << endl; return TestFail; } if (!file.unmap(data.data())) { cerr << "Unmapping of complete file failed" << endl; return TestFail; } data = file.map(4096, 8192); if (data.empty()) { cerr << "Mapping of file region failed" << endl; return TestFail; } if (data.size() != 8192) { cerr << "Mapping of file region has invalid size" << endl; return TestFail; } if (!file.unmap(data.data())) { cerr << "Unmapping of file region failed" << endl; return TestFail; } file.close(); /* Test private mapping. */ file.setFileName(fileName_); file.open(File::OpenModeFlag::ReadWrite); data = file.map(0, -1, File::MapFlag::Private); if (data.empty()) { cerr << "Private mapping failed" << endl; return TestFail; } std::string str{ reinterpret_cast<char *>(data.data()), data.size() }; if (str != "libcamera") { cerr << "Invalid contents of private mapping" << endl; return TestFail; } memcpy(data.data(), "LIBCAMERA", 9); if (!file.unmap(data.data())) { cerr << "Private unmapping failed" << endl; return TestFail; } data = file.map(); str = { reinterpret_cast<char *>(data.data()), data.size() }; if (str != "libcamera") { cerr << "Private mapping changed file contents" << endl; return TestFail; } /* Test shared mapping. */ data = file.map(); if (data.empty()) { cerr << "Shared mapping failed" << endl; return TestFail; } memcpy(data.data(), "LIBCAMERA", 9); if (!file.unmap(data.data())) { cerr << "Shared unmapping failed" << endl; return TestFail; } data = file.map(); str = { reinterpret_cast<char *>(data.data()), data.size() }; if (str != "LIBCAMERA") { cerr << "Shared mapping failed to change file contents" << endl; return TestFail; } return TestPass; } void cleanup() { unlink(fileName_.c_str()); } private: std::string fileName_; }; TEST_REGISTER(FileTest)