Files
external_libcamera/test/libtest/test.cpp
Barnabás Pőcze b181327131 test: Remove uses of O_TMPFILE
`O_TMPFILE` requires file system support, which may not be available in
certain environments, usually containerized ones. So do not use it.

A new function is added for tests to be able to create unnamed temporary
files using `libcamera::MemFd` as the implementation.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2026-02-10 09:53:32 +01:00

50 lines
593 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* libcamera test base class
*/
#include <stdlib.h>
#include "test.h"
#include <libcamera/base/memfd.h>
Test::Test()
{
}
Test::~Test()
{
}
void Test::setArgs([[maybe_unused]] int argc, char *argv[])
{
self_ = argv[0];
}
int Test::execute()
{
int ret;
ret = init();
if (ret)
return ret;
ret = run();
cleanup();
return ret;
}
namespace test {
libcamera::UniqueFD createTemporaryFile()
{
return libcamera::MemFd::create("libcamera-test-temporary-file", 0);
}
} /* namespace test */