summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2020-12-19 03:12:38 +0200
committerPovilas Kanapickas <povilas@radix.lt>2020-12-19 03:16:16 +0200
commit2ea48952a161bad060838ee79eb177f6d382ace6 (patch)
treeda6525a4d01112197531afcc4ed93326defe16f0
parent4ea8edb40c81506ed9450abfcad64b61b5062038 (diff)
Remove evdev-based test device implementation
evdev driver is unreliable for testing because with input thread there is race condition between input event submission and the reaction by the X server. The inputtest driver has the required synchronization capabilities.
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--gtest/.gitlab-ci.yml2
-rw-r--r--gtest/include/xorg/gtest/evemu/xorg-gtest-device.h146
-rw-r--r--gtest/include/xorg/gtest/xorg-gtest.h1
-rw-r--r--gtest/src/device.cpp269
-rw-r--r--gtest/test/.gitignore1
-rw-r--r--gtest/test/device-test.cpp196
-rw-r--r--gtest/test/xserver-test.cpp36
-rw-r--r--meson.build12
-rw-r--r--tests/common/device-interface.cpp35
-rw-r--r--tests/common/device-interface.h52
-rw-r--r--tests/lib/libX11.cpp1
-rw-r--r--tests/server/grab.cpp2
-rw-r--r--tests/server/input.cpp3
-rw-r--r--tests/server/xephyr.cpp1
15 files changed, 6 insertions, 753 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f6eb268..2ae3b06 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,7 +15,7 @@ stages:
variables:
FDO_DISTRIBUTION_TAG: '2020-12-14.0' # change this to rebuild the images
FDO_DISTRIBUTION_VERSION: 'stable'
- FDO_DISTRIBUTION_PACKAGES: 'git ca-certificates meson g++ pkgconf libevemu-dev libevdev-dev libpixman-1-dev xserver-xorg-input-wacom libx11-dev libxi-dev libxext-dev libxrandr-dev libxtst-dev libxxf86dga-dev'
+ FDO_DISTRIBUTION_PACKAGES: 'git ca-certificates meson g++ pkgconf libpixman-1-dev xserver-xorg-input-wacom libx11-dev libxi-dev libxext-dev libxrandr-dev libxtst-dev libxxf86dga-dev'
MESON_BUILDDIR: 'build dir'
NINJA_ARGS: ''
diff --git a/gtest/.gitlab-ci.yml b/gtest/.gitlab-ci.yml
index 0aee1fa..98bc50e 100644
--- a/gtest/.gitlab-ci.yml
+++ b/gtest/.gitlab-ci.yml
@@ -14,7 +14,7 @@ stages:
variables:
FDO_DISTRIBUTION_TAG: '2020-11-30.0' # change this to rebuild the images
FDO_DISTRIBUTION_VERSION: 'stable'
- FDO_DISTRIBUTION_PACKAGES: 'meson g++ pkgconf libevemu-dev libevdev-dev libx11-dev libxi-dev libxext-dev'
+ FDO_DISTRIBUTION_PACKAGES: 'meson g++ pkgconf libx11-dev libxi-dev libxext-dev'
container-prep:
extends:
diff --git a/gtest/include/xorg/gtest/evemu/xorg-gtest-device.h b/gtest/include/xorg/gtest/evemu/xorg-gtest-device.h
deleted file mode 100644
index 62f6439..0000000
--- a/gtest/include/xorg/gtest/evemu/xorg-gtest-device.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- *
- * X testing environment - Google Test environment feat. dummy x server
- *
- * Copyright (C) 2012 Canonical Ltd.
- * Copyright © 2012 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- ******************************************************************************/
-
-#ifndef XORG_GTEST_EVEMU_DEVICE_H_
-#define XORG_GTEST_EVEMU_DEVICE_H_
-
-#include <memory>
-#include <string>
-
-extern "C" {
-
-#include <evemu.h>
-
-} // extern "C"
-
-namespace xorg {
-namespace testing {
-namespace evemu {
-
-/**
- * @class Device xorg-gtest-device.h xorg/gtest/evemu/xorg-gtest-device.h
- *
- * evemu input device for replaying events through the Linux uinput
- * evdev subsystem.
- *
- * Use the Recording class to play back a specific recording.
- */
-
-class Device {
- public:
- /**
- * Create a new device context.
- *
- * @param [in] path Path to evemu device property file.
- *
- * @throws std::runtime_error if the device property file could not be found
- * or the device could not be created.
- */
- explicit Device(const std::string& path);
- ~Device();
-
- /**
- * Play a evemu recording through the device.
- *
- * Plays the recording from the beginning through the end. This call will
- * block until the recording has finished.
- *
- * @param [in] path Path to evemu recording file.
- *
- * @throws std::runtime_error if playback failed for any reason.
- */
- void Play(const std::string& path) const;
-
- /**
- * Play a single event through the device.
- *
- * Plays an event with the given type, code and value through the device.
- *
- * @param [in] type Evdev interface event type, e.g. EV_ABS, EV_REL, EV_KEY.
- * @param [in] code Evdev interface event code, e.g. ABS_X, REL_Y, BTN_LEFT
- * @param [in] value Event value
- * @param [in] sync If true, submit an EV_SYN event after this event
- *
- * @throws std::runtime_error if playback failed for any reason.
- */
- void PlayOne(int type, int code, int value, bool sync = false);
-
- /**
- * Return the /dev/input/eventX device node for this device.
- *
- * Note that evemu doesn't know the device node, so we traverse the file
- * system looking for it. There is a tiny chance of the device node being
- * wrong, or the device disappearing before we find it. If the device
- * node cannot be found, an empty string is returned.
- *
- * @return The string representing the device node
- */
- const std::string& GetDeviceNode(void);
-
- /**
- * Check if a device supports a specific event.
- *
- * @param [in] type Type of the event (EV_REL, EV_ABS, ...)
- * @param [in] code Event code (ABS_X, REL_Y, ...)
- *
- * @return true if this device supports this event or false otherwise.
- */
- bool HasEvent(int type, int code);
-
- /**
- * Retrieve data about an absolute axis on this device.
- *
- * @param [in] code The axis to query (e.g. ABS_X)
- * @param [out] min Min value for this axis
- * @param [out] max Max value for this axis
- * @param [out] fuzz Fuzz value for this axis
- * @param [out] flat Flat value for this axis
- * @param [out] resolution Resolution of this axis
- *
- * @return false if this device doesn't have this axis, or true on success
- */
- bool GetAbsData(int code, int *min, int *max,
- int *fuzz = nullptr, int *flat = nullptr, int *resolution = nullptr);
-
-
- private:
- struct Private;
- std::unique_ptr<Private> d_;
-
- /* Disable copy constructor & assignment operator */
- Device(const Device&);
- Device& operator=(const Device&);
-
- void GuessDeviceNode(time_t ctime);
-};
-
-} // namespace evemu
-} // namespace testing
-} // namespace xorg
-
-#endif // XORG_GTEST_EVEMU_DEVICE_H_
diff --git a/gtest/include/xorg/gtest/xorg-gtest.h b/gtest/include/xorg/gtest/xorg-gtest.h
index 68359c7..03786c8 100644
--- a/gtest/include/xorg/gtest/xorg-gtest.h
+++ b/gtest/include/xorg/gtest/xorg-gtest.h
@@ -32,7 +32,6 @@
#include "xorg-gtest-process.h"
#include "xorg-gtest-xserver.h"
#include "xorg-gtest-test.h"
-#include "evemu/xorg-gtest-device.h"
#include "inputtest/xorg-gtest-device.h"
#include "inputtest/xorg-gtest-valuators.h"
diff --git a/gtest/src/device.cpp b/gtest/src/device.cpp
deleted file mode 100644
index 5e3c562..0000000
--- a/gtest/src/device.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- *
- * X testing environment - Google Test environment feat. dummy x server
- *
- * Copyright (C) 2012 Canonical Ltd.
- * Copyright © 2012 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- ******************************************************************************/
-
-#include "xorg/gtest/evemu/xorg-gtest-device.h"
-
-#include <linux/input.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/inotify.h>
-#include <poll.h>
-
-#include <stdexcept>
-
-#include <gtest/gtest.h>
-
-#define SYS_INPUT_DIR "/sys/class/input"
-#define DEV_INPUT_DIR "/dev/input/"
-
-struct xorg::testing::evemu::Device::Private {
- Private() : fd(-1), device(nullptr), device_node() {}
-
- int fd;
- struct evemu_device* device;
- std::string device_node;
- time_t ctime;
-};
-
-static int _event_device_compare(const struct dirent **a,
- const struct dirent **b) {
- int na, nb;
-
- sscanf((*a)->d_name, "event%d", &na);
- sscanf((*b)->d_name, "event%d", &nb);
-
- return (na > nb) ? 1 : (na < nb) ? -1 : 0;
-
-}
-
-static int _event_device_filter(const struct dirent *d) {
- return (strncmp("event", d->d_name, sizeof("event") - 1) == 0);
-}
-
-static bool event_is_device(const std::string &path,
- const std::string &devname,
- time_t ctime) {
- char device_name[256];
- bool equal = false;
- int fd = open(path.c_str(), O_RDONLY);
-
- if (fd == -1)
- return false;
-
- if (ioctl(fd, EVIOCGNAME(sizeof(device_name)), device_name) != -1 &&
- devname.compare(device_name) == 0) {
- struct stat buf;
-
- if (fstat(fd, &buf) == 0)
- if (buf.st_ctime >= ctime)
- equal = true;
- }
- close(fd);
-
- return equal;
-}
-
-void xorg::testing::evemu::Device::GuessDeviceNode(time_t ctime) {
- struct dirent **event_devices = nullptr;
- int n_event_devices;
-
- n_event_devices = scandir(SYS_INPUT_DIR, &event_devices,
- _event_device_filter, _event_device_compare);
-
- bool found = false;
- for (int i = 0; i < n_event_devices && !found; i++) {
- std::stringstream s;
- s << DEV_INPUT_DIR << event_devices[i]->d_name;
- found = event_is_device(s.str(), evemu_get_name(d_->device), ctime);
- if (found)
- d_->device_node = s.str();
- }
-
- if (!found)
- std::cerr << "Failed to guess device node." << std::endl;
-
- for (int i = 0; i < n_event_devices; i++)
- free(event_devices[i]);
- free(event_devices);
-}
-
-static std::string wait_for_inotify(int fd)
-{
- std::string devnode;
- bool found = false;
- struct pollfd pfd;
-
- pfd.fd = fd;
- pfd.events = POLLIN;
-
- char buf[1024];
- size_t bufidx = 0;
-
- while (!found && poll(&pfd, 1, 2000) > 0) {
- ssize_t r;
-
- r = read(fd, buf + bufidx, sizeof(buf) - bufidx);
- if (r == -1 && errno != EAGAIN) {
- std::cerr << "inotify read failed with: " << std::string(strerror(errno)) << std::endl;
- break;
- }
-
- bufidx += r;
-
- struct inotify_event *e = reinterpret_cast<struct inotify_event*>(buf);
-
- while (bufidx > sizeof(*e) && bufidx >= sizeof(*e) + e->len) {
- if (strncmp(e->name, "event", 5) == 0) {
- devnode = DEV_INPUT_DIR + std::string(e->name);
- found = true;
- break;
- }
-
- /* this packet didn't contain what we're looking for */
- int len = sizeof(*e) + e->len;
- memmove(buf, buf + len, bufidx - len);
- bufidx -= len;
- }
- }
-
- return devnode;
-}
-
-xorg::testing::evemu::Device::Device(const std::string& path)
- : d_(new Private) {
- static const char UINPUT_NODE[] = "/dev/uinput";
-
- d_->device = evemu_new(nullptr);
- if (!d_->device)
- throw std::runtime_error("Failed to create evemu record");
-
- FILE* fp = fopen(path.c_str(), "r");
- if (fp == nullptr) {
- evemu_delete(d_->device);
- throw std::runtime_error("Failed to open device file " + path);
- }
-
- if (evemu_read(d_->device, fp) <= 0) {
- fclose(fp);
- evemu_delete(d_->device);
- throw std::runtime_error("Failed to read device file");
- }
-
- fclose(fp);
-
- int ifd = inotify_init1(IN_NONBLOCK);
- if (ifd == -1 || inotify_add_watch(ifd, DEV_INPUT_DIR, IN_CREATE) == -1) {
- std::cerr << "Failed to create inotify watch" << std::endl;
- if (ifd != -1)
- close(ifd);
- ifd = -1;
- }
-
- d_->fd = open(UINPUT_NODE, O_WRONLY);
- if (d_->fd < 0) {
- evemu_delete(d_->device);
- throw std::runtime_error("Failed to open uinput node");
- }
-
- d_->ctime = time(nullptr);
- if (evemu_create(d_->device, d_->fd) < 0) {
- close(d_->fd);
- evemu_delete(d_->device);
- throw std::runtime_error("Failed to create evemu device");
- }
-
- if (ifd != -1) {
- std::string devnode = wait_for_inotify(ifd);
- if (event_is_device(devnode, evemu_get_name(d_->device), d_->ctime))
- d_->device_node = devnode;
- close(ifd);
- } /* else guess node when we'll need it */
-}
-
-void xorg::testing::evemu::Device::Play(const std::string& path) const {
- FILE* file = fopen(path.c_str(), "r");
- if (!file)
- throw std::runtime_error("Failed to open recording file");
-
- if (evemu_play(file, d_->fd) != 0) {
- fclose(file);
- throw std::runtime_error("Failed to play evemu recording");
- }
-
- fclose(file);
-}
-
-void xorg::testing::evemu::Device::PlayOne(int type, int code, int value, bool sync)
-{
- struct input_event ev;
- if (evemu_create_event(&ev, type, code, value))
- throw std::runtime_error("Failed to create event");
-
- if (evemu_play_one(d_->fd, &ev))
- throw std::runtime_error("Failed to play event");
-
- if (sync) {
- if (evemu_create_event(&ev, EV_SYN, SYN_REPORT, 0))
- throw std::runtime_error("Failed to create EV_SYN event");
-
- if (evemu_play_one(d_->fd, &ev))
- throw std::runtime_error("Failed to play EV_SYN event");
- }
-}
-
-bool xorg::testing::evemu::Device::HasEvent(int type, int code)
-{
- return evemu_has_event(d_->device, type, code);
-}
-
-bool xorg::testing::evemu::Device::GetAbsData(int code, int *min, int *max, int *fuzz, int *flat, int *resolution)
-{
- if (!HasEvent(EV_ABS, code))
- return false;
-
- *min = evemu_get_abs_minimum(d_->device, code);
- *max = evemu_get_abs_maximum(d_->device, code);
- if (fuzz)
- *fuzz = evemu_get_abs_fuzz(d_->device, code);
- if (flat)
- *flat = evemu_get_abs_flat(d_->device, code);
- if (resolution)
- *resolution = evemu_get_abs_resolution(d_->device, code);
- return true;
-}
-
-const std::string& xorg::testing::evemu::Device::GetDeviceNode(void) {
- if (d_->device_node.empty())
- GuessDeviceNode(d_->ctime);
- return d_->device_node;
-}
-
-xorg::testing::evemu::Device::~Device() {
- close(d_->fd);
- evemu_delete(d_->device);
-}
diff --git a/gtest/test/.gitignore b/gtest/test/.gitignore
index e2b9a87..17876af 100644
--- a/gtest/test/.gitignore
+++ b/gtest/test/.gitignore
@@ -2,4 +2,3 @@ process-test
process-test-helper
xserver-test
xserver-test-helper
-device-test
diff --git a/gtest/test/device-test.cpp b/gtest/test/device-test.cpp
deleted file mode 100644
index e70a59a..0000000
--- a/gtest/test/device-test.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-#include <gtest/gtest.h>
-#include <xorg/gtest/xorg-gtest.h>
-
-#ifndef BTN_TOOL_QUINTTAP
-#define BTN_TOOL_QUINTTAP 0x148
-#endif
-
-using namespace xorg::testing;
-
-TEST(Device, DeviceNode)
-{
- XORG_TESTCASE("Device node is /dev/input/eventX");
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE.desc");
-
- ASSERT_EQ(d.GetDeviceNode().compare(0, 16, "/dev/input/event"), 0);
-}
-
-TEST(Device, InotifyWait)
-{
- XORG_TESTCASE("device node can never be empty.\n"
- "This test may show false positives");
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE.desc");
-
- ASSERT_FALSE(d.GetDeviceNode().empty());
-}
-
-TEST(Device, HasEvent)
-{
- XORG_TESTCASE("HasEvent must return the right bits.\n");
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE.desc");
-
- for (int i = ABS_X; i < ABS_MAX; i++)
- ASSERT_FALSE(d.HasEvent(EV_ABS, i)) << "Axis code " << i;
-
- for (int i = REL_X; i < REL_MAX; i++) {
- if (i == REL_X || i == REL_Y || i == REL_WHEEL)
- ASSERT_TRUE(d.HasEvent(EV_REL, i)) << "Axis code " << i;
- else
- ASSERT_FALSE(d.HasEvent(EV_REL, i)) << "Axis code " << i;
- }
-
- for (int i = BTN_LEFT; i < KEY_MAX; i++) {
- if (i == BTN_LEFT || i == BTN_RIGHT || i == BTN_MIDDLE)
- ASSERT_TRUE(d.HasEvent(EV_KEY, i)) << "Axis code " << i;
- else
- ASSERT_FALSE(d.HasEvent(EV_KEY, i)) << "Axis code " << i;
- }
-
- xorg::testing::evemu::Device d2(RECORDINGS_DIR "touchpads/SynPS2-Synaptics-TouchPad.desc");
-
- for (int i = REL_X; i < REL_MAX; i++)
- ASSERT_FALSE(d2.HasEvent(EV_REL, i)) << "Axis code " << i;
-
- for (int i = ABS_X; i < ABS_MAX; i++) {
- switch (i) {
- case ABS_X:
- case ABS_Y:
- case ABS_PRESSURE:
- case ABS_TOOL_WIDTH:
- case ABS_MT_SLOT:
- case ABS_MT_POSITION_X:
- case ABS_MT_POSITION_Y:
- case ABS_MT_TRACKING_ID:
- case ABS_MT_PRESSURE:
- ASSERT_TRUE(d2.HasEvent(EV_ABS, i)) << "Axis code " << i;
- break;
- default:
- ASSERT_FALSE(d2.HasEvent(EV_REL, i)) << "Axis code " << i;
- break;
-
- }
- }
-
- for (int i = BTN_LEFT; i < KEY_MAX; i++) {
- switch (i) {
- case BTN_LEFT:
- case BTN_TOOL_FINGER:
- case BTN_TOOL_QUINTTAP:
- case BTN_TOUCH:
- case BTN_TOOL_DOUBLETAP:
- case BTN_TOOL_TRIPLETAP:
- case BTN_TOOL_QUADTAP:
- ASSERT_TRUE(d2.HasEvent(EV_KEY, i)) << "Axis code " << i;
- break;
- default:
- ASSERT_FALSE(d2.HasEvent(EV_KEY, i)) << "Axis code " << i;
- }
- }
-
-}
-
-TEST(Device, AbsAxisData) {
- XORG_TESTCASE("GetAbsData must return the right values.\n");
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "touchpads/SynPS2-Synaptics-TouchPad.desc");
-
- const int DEFAULT = -3;
-
- for (int i = ABS_X; i < ABS_MAX; i++) {
- int min = 0, max = 0, fuzz = 0, flat = 0, resolution = 0;
- bool axis_exists = 1;
-
- switch (i) {
- case ABS_X:
- case ABS_MT_POSITION_X:
- min = 1472;
- max = 5472;
- fuzz = 8;
- break;
- case ABS_Y:
- case ABS_MT_POSITION_Y:
- min = 1408;
- max = 4448;
- fuzz = 8;
- break;
- case ABS_PRESSURE:
- min = 0;
- max = 255;
- break;
- case ABS_TOOL_WIDTH:
- min = 0;
- max = 15;
- break;
- case ABS_MT_SLOT:
- min = 0;
- max = 1;
- break;
- case ABS_MT_TRACKING_ID:
- min = 0;
- max = 65535;
- break;
- case ABS_MT_PRESSURE:
- min = 0;
- max = 255;
- break;
- default:
- axis_exists = false;
- break;
- }
-
- if (axis_exists) {
- int min_ret = min;
- int max_ret = max;
- int fuzz_ret = fuzz;
- int flat_ret = flat;
- int res_ret = resolution;
-
- ASSERT_TRUE(d.GetAbsData(i, &min_ret, &max_ret)) << "Axis code " << i;
- ASSERT_EQ(min, min_ret);
- ASSERT_EQ(max, max_ret);
-
- ASSERT_TRUE(d.GetAbsData(i, &min_ret, &max_ret, &fuzz)) << "Axis code " << i;
- ASSERT_EQ(min, min_ret);
- ASSERT_EQ(max, max_ret);
- ASSERT_EQ(fuzz, fuzz_ret);
-
- ASSERT_TRUE(d.GetAbsData(i, &min_ret, &max_ret, &fuzz, &flat)) << "Axis code " << i;
- ASSERT_EQ(min, min_ret);
- ASSERT_EQ(max, max_ret);
- ASSERT_EQ(fuzz, fuzz_ret);
- ASSERT_EQ(flat, flat_ret);
-
- ASSERT_TRUE(d.GetAbsData(i, &min_ret, &max_ret, &fuzz, &flat, &res_ret)) << "Axis code " << i;
- ASSERT_EQ(min, min_ret);
- ASSERT_EQ(max, max_ret);
- ASSERT_EQ(fuzz, fuzz_ret);
- ASSERT_EQ(flat, flat_ret);
- ASSERT_EQ(res_ret, resolution);
- } else {
- min = DEFAULT;
- max = DEFAULT;
- fuzz = DEFAULT;
- flat = DEFAULT;
- resolution = DEFAULT;
-
- ASSERT_FALSE(d.GetAbsData(i, &min, &max)) << "Axis code " << i;
-
- /* make sure we didn't overwrite the values */
- ASSERT_EQ(min, DEFAULT);
- ASSERT_EQ(max, DEFAULT);
- ASSERT_EQ(fuzz, DEFAULT);
- ASSERT_EQ(flat, DEFAULT);
- ASSERT_EQ(resolution, DEFAULT);
- }
-
- }
-}
-
-int main(int argc, char *argv[]) {
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
diff --git a/gtest/test/xserver-test.cpp b/gtest/test/xserver-test.cpp
index 6d5eeeb..f703402 100644
--- a/gtest/test/xserver-test.cpp
+++ b/gtest/test/xserver-test.cpp
@@ -166,42 +166,6 @@ TEST(XServer, WaitForDeviceEventMask)
delete m.mask;
}
-TEST(XServer, WaitForExistingDevice)
-{
- XORG_TESTCASE("WaitForDevice() returns true for already existing device");
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE.desc");
-
- XServer server;
- server.SetOption("-logfile", LOGFILE_DIR "/Xorg-WaitForDevice.log");
- server.SetOption("-config", DUMMY_CONF_PATH);
- server.SetOption("-noreset", "");
- server.Start();
- ASSERT_EQ(server.GetState(), Process::RUNNING);
- ::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != nullptr);
-
- ASSERT_TRUE(XServer::WaitForDevice(dpy, "PIXART USB OPTICAL MOUSE", 1000));
-}
-
-TEST(XServer, WaitForNewDevice)
-{
- XORG_TESTCASE("WaitForDevice() waits for newly created dvice");
-
- XServer server;
- server.SetOption("-logfile", LOGFILE_DIR "/Xorg-WaitForDevice.log");
- server.SetOption("-config", DUMMY_CONF_PATH);
- server.SetOption("-noreset", "");
- server.Start();
- ASSERT_EQ(server.GetState(), Process::RUNNING);
- ::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != nullptr);
-
- xorg::testing::evemu::Device d(RECORDINGS_DIR "mice/PIXART-USB-OPTICAL-MOUSE.desc");
-
- ASSERT_TRUE(XServer::WaitForDevice(dpy, "PIXART USB OPTICAL MOUSE", 1000));
-}
-
TEST(XServer, IOErrorException)
{
ASSERT_THROW({
diff --git a/meson.build b/meson.build
index d9db502..f0bf895 100644
--- a/meson.build
+++ b/meson.build
@@ -61,13 +61,11 @@ xorg_gtest_sources = files(
'gtest/include/xorg/gtest/xorg-gtest-xserver.h',
'gtest/include/xorg/gtest/inputtest/xorg-gtest-device.h',
'gtest/include/xorg/gtest/inputtest/xorg-gtest-valuators.h',
- 'gtest/include/xorg/gtest/evemu/xorg-gtest-device.h',
'gtest/include/xorg/gtest/xorg-gtest.h',
'gtest/src/defines.h',
'gtest/src/xorg-gtest_main.cpp',
'gtest/src/environment.cpp',
- 'gtest/src/device.cpp',
'gtest/src/process.cpp',
'gtest/src/test.cpp',
'gtest/src/inputtest-device.cpp',
@@ -122,14 +120,6 @@ test('test-process',
),
is_parallel: false,
)
-test('test-device',
- executable('test-device',
- 'gtest/test/device-test.cpp',
- dependencies: dep_xorg_gtest,
- install: false,
- ),
- is_parallel: false,
-)
executable('xserver-test-helper',
'gtest/test/xserver-test-helper.cpp',
install: false)
@@ -164,8 +154,6 @@ common_sources = files(
'tests/common/xorg-conf.h',
'tests/common/helpers.cpp',
'tests/common/helpers.h',
- 'tests/common/device-interface.cpp',
- 'tests/common/device-interface.h',
'tests/common/device-inputtest-interface.cpp',
'tests/common/device-inputtest-interface.h',
'tests/common/video-driver-test.h',
diff --git a/tests/common/device-interface.cpp b/tests/common/device-interface.cpp
deleted file mode 100644
index df789d2..0000000
--- a/tests/common/device-interface.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2012-2013 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "device-interface.h"
-
-void DeviceInterface::SetDevice(const std::string& path, const std::string &basedir)
-{
- dev = std::unique_ptr<xorg::testing::evemu::Device>(
- new xorg::testing::evemu::Device(basedir + path));
-}
diff --git a/tests/common/device-interface.h b/tests/common/device-interface.h
deleted file mode 100644
index 4afd71e..0000000
--- a/tests/common/device-interface.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright © 2012-2013 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _DEVICE_INTERFACE_H_
-#define _DEVICE_INTERFACE_H_
-
-#include <xorg/gtest/xorg-gtest.h>
-#include <memory>
-
-/**
- * A test fixture for testing input drivers. This class automates basic
- * device setup throught the server config file.
- *
- * Do not instantiate this class directly, subclass it from the test case
- * instead. For simple test cases, use SimpleInputDriverTest.
- */
-class DeviceInterface {
-protected:
- /**
- * The evemu device to generate events.
- */
- std::unique_ptr<xorg::testing::evemu::Device> dev;
-
- virtual void SetDevice(const std::string& path, const std::string &basedir = RECORDINGS_DIR);
-};
-
-#endif
diff --git a/tests/lib/libX11.cpp b/tests/lib/libX11.cpp
index 3ca2b74..571e101 100644
--- a/tests/lib/libX11.cpp
+++ b/tests/lib/libX11.cpp
@@ -33,7 +33,6 @@
#include <X11/Xlibint.h>
#include <xit-server-input-test.h>
-#include <device-interface.h>
#include "helpers.h"
#include "xit-event.h"
diff --git a/tests/server/grab.cpp b/tests/server/grab.cpp
index 161917b..f0cfa58 100644
--- a/tests/server/grab.cpp
+++ b/tests/server/grab.cpp
@@ -35,6 +35,8 @@
#include <X11/extensions/XInput2.h>
#include <X11/extensions/XInput.h>
+#include <linux/input-event-codes.h>
+
#include "xit-event.h"
#include "xit-server-input-test.h"
#include "device-inputtest-interface.h"
diff --git a/tests/server/input.cpp b/tests/server/input.cpp
index 0ad48fe..68968d3 100644
--- a/tests/server/input.cpp
+++ b/tests/server/input.cpp
@@ -37,10 +37,11 @@
#include <X11/extensions/XInput2.h>
#include <X11/extensions/XInput.h>
+#include <linux/input-event-codes.h>
+
#include "xit-server-input-test.h"
#include "xit-event.h"
#include "xit-property.h"
-#include "device-interface.h"
#include "device-inputtest-interface.h"
#include "helpers.h"
diff --git a/tests/server/xephyr.cpp b/tests/server/xephyr.cpp
index e604d31..ce11c00 100644
--- a/tests/server/xephyr.cpp
+++ b/tests/server/xephyr.cpp
@@ -31,7 +31,6 @@
#include <xorg/gtest/xorg-gtest.h>
#include "xit-server-input-test.h"
-#include "device-interface.h"
#include "helpers.h"
using namespace xorg::testing;