Closed ethaniel closed 2 years ago
I think that use-case is out of scope for umockdev. I am sure it is technically possible to manipulate the environment to the point that you can fool such a tool. But, the purpose of umockdev is to just provide enough in order to enable CI testing for software.
It is impossible to answer the question without knowing what that tool does.
The software is querying:
I was thinking if there is a way to override the request to these 2 items and replace the output that the software gets?
Solved it myself. Replaced /bin/udevadm with a bash script which outputs data that I need.
And also did sudo mount --bind /cpuinfo.txt /proc/cpuinfo
to fake the /proc/cpuinfo data
@ethaniel : Thanks for the clarification -- these parts are indeed what umockdev does. See the documented examples how to fake files in /proc, you can dump your desired /dev/sda with umockdev-record
and load it in the test environment.
However, of course you need to run your program under umockdev-run
for that. If you want everything in your system to believe the above fake data, without running under umockdev-run, then you need root privs as you did.
I have a program which gathers system information (CPU, Motherboard, Hard drive models, etc) via udevadm to generate license information. Unfortunately, it's built so it won't allow itself to be run in a KVM/QEMU environment (which my whole system is based on).
Is there a way to make it think that it's running on a bare metal system?