mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
Add zesDeviceReset ULTs.
This patch adds two ULTs. Verify that an IN USE error is returned if the device is open by another process. Verify that reset succeeds if device is not in use. Verify that reset with force succeeds if device is in use. Verify that reset without force succeeds if device is opened during reset, and process is killed. Verify that reset with force fails with device in use if device is opened during reset, and process will not die Change-Id: I232572c192bc481d8d63ef39c7494976100325ff Signed-off-by: Bill Jordan <bill.jordan@intel.com>
This commit is contained in:
@@ -30,7 +30,6 @@ class FsAccess {
|
||||
|
||||
virtual ze_result_t canRead(const std::string file);
|
||||
virtual ze_result_t canWrite(const std::string file);
|
||||
ze_result_t exists(const std::string file);
|
||||
virtual ze_result_t getFileMode(const std::string file, ::mode_t &mode);
|
||||
|
||||
virtual ze_result_t read(const std::string file, uint64_t &val);
|
||||
@@ -58,15 +57,17 @@ class ProcfsAccess : private FsAccess {
|
||||
static ProcfsAccess *create();
|
||||
~ProcfsAccess() override = default;
|
||||
|
||||
ze_result_t listProcesses(std::vector<::pid_t> &list);
|
||||
::pid_t myProcessId();
|
||||
ze_result_t getFileDescriptors(const ::pid_t pid, std::vector<int> &list);
|
||||
ze_result_t getFileName(const ::pid_t pid, const int fd, std::string &val);
|
||||
ze_result_t isAlive(const ::pid_t pid);
|
||||
MOCKABLE_VIRTUAL ze_result_t listProcesses(std::vector<::pid_t> &list);
|
||||
MOCKABLE_VIRTUAL ::pid_t myProcessId();
|
||||
MOCKABLE_VIRTUAL ze_result_t getFileDescriptors(const ::pid_t pid, std::vector<int> &list);
|
||||
MOCKABLE_VIRTUAL ze_result_t getFileName(const ::pid_t pid, const int fd, std::string &val);
|
||||
MOCKABLE_VIRTUAL bool isAlive(const ::pid_t pid);
|
||||
MOCKABLE_VIRTUAL void kill(const ::pid_t pid);
|
||||
|
||||
private:
|
||||
protected:
|
||||
ProcfsAccess() = default;
|
||||
|
||||
private:
|
||||
std::string fullPath(const ::pid_t pid);
|
||||
std::string fdDirPath(const ::pid_t pid);
|
||||
std::string fullFdPath(const ::pid_t pid, const int fd);
|
||||
@@ -100,10 +101,10 @@ class SysfsAccess : private FsAccess {
|
||||
MOCKABLE_VIRTUAL ze_result_t scanDirEntries(const std::string path, std::vector<std::string> &list);
|
||||
ze_result_t readSymLink(const std::string path, std::string &buf) override;
|
||||
ze_result_t getRealPath(const std::string path, std::string &buf) override;
|
||||
ze_result_t bindDevice(const std::string device);
|
||||
ze_result_t unbindDevice(const std::string device);
|
||||
bool fileExists(const std::string file) override;
|
||||
ze_bool_t isMyDeviceFile(const std::string dev);
|
||||
MOCKABLE_VIRTUAL ze_result_t bindDevice(const std::string device);
|
||||
MOCKABLE_VIRTUAL ze_result_t unbindDevice(const std::string device);
|
||||
MOCKABLE_VIRTUAL bool fileExists(const std::string file) override;
|
||||
MOCKABLE_VIRTUAL bool isMyDeviceFile(const std::string dev);
|
||||
|
||||
private:
|
||||
SysfsAccess(const std::string file);
|
||||
|
||||
Reference in New Issue
Block a user