simpletest: Take file to open as argument
This commit is contained in:
parent
2462284dc5
commit
509e64a341
3 changed files with 34 additions and 6 deletions
|
@ -1,6 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
res=0
|
||||
|
||||
# Devices that exist on sr.ht
|
||||
if [ -e "/dev/input/event0" ]
|
||||
then
|
||||
file="/dev/input/event0"
|
||||
elif [ -e "/dev/dri/card0" ]
|
||||
then
|
||||
file="/dev/dri/card0"
|
||||
else
|
||||
echo "No useful device file found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Run simpletest a few times
|
||||
#
|
||||
|
@ -8,7 +21,7 @@ cnt=0
|
|||
while [ "$cnt" -lt 5 ]
|
||||
do
|
||||
echo "Simpletest run $cnt"
|
||||
if ! sudo LIBSEAT_BACKEND=builtin LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest
|
||||
if ! sudo LIBSEAT_BACKEND=builtin LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest $file
|
||||
then
|
||||
echo "Simpletest failed"
|
||||
res=1
|
||||
|
|
|
@ -22,6 +22,18 @@ fi
|
|||
|
||||
sudo chmod 777 ./seatd.sock
|
||||
|
||||
# Devices that exist on sr.ht
|
||||
if [ -e "/dev/input/event0" ]
|
||||
then
|
||||
file="/dev/input/event0"
|
||||
elif [ -e "/dev/dri/card0" ]
|
||||
then
|
||||
file="/dev/dri/card0"
|
||||
else
|
||||
echo "No useful device file found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Run simpletest a few times
|
||||
#
|
||||
|
@ -29,7 +41,7 @@ cnt=0
|
|||
while [ "$cnt" -lt 5 ]
|
||||
do
|
||||
echo "Simpletest run $cnt"
|
||||
if ! LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest
|
||||
if ! LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest $file
|
||||
then
|
||||
echo "Simpletest failed"
|
||||
sudo killall seatd
|
||||
|
|
|
@ -21,8 +21,11 @@ static void handle_disable(struct libseat *backend, void *data) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Specify name of file to open as argument\n");
|
||||
return -1;
|
||||
}
|
||||
char *file = argv[1];
|
||||
|
||||
int active = 0;
|
||||
struct libseat_seat_listener listener = {
|
||||
|
@ -44,9 +47,9 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(stderr, "active!\n");
|
||||
|
||||
int fd, device;
|
||||
device = libseat_open_device(backend, "/dev/dri/card0", &fd);
|
||||
device = libseat_open_device(backend, file, &fd);
|
||||
fprintf(stderr, "libseat_open_device(backend: %p, path: %s, fd: %p) = %d\n",
|
||||
(void *)backend, "/dev/dri/card0", (void *)&fd, device);
|
||||
(void *)backend, file, (void *)&fd, device);
|
||||
if (device == -1) {
|
||||
fprintf(stderr, "libseat_open_device() failed: %s\n", strerror(errno));
|
||||
libseat_close_seat(backend);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue