summaryrefslogtreecommitdiff
path: root/tests/video/video-module-load.cpp
blob: 7398f313aa840019b00d896df1deb1300386c0af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdexcept>
#include <fstream>
#include <xorg/gtest/xorg-gtest.h>

#include "video-driver-test.h"

class VideoModuleLoadTest : public SimpleVideoDriverTest {
public:
    virtual void SetUp() {
        try {
            SimpleVideoDriverTest::SetUp();
        } catch (std::runtime_error &e) {
            /* We don't care if SetUp() can't connect to the display */
        }
    }
};

TEST_P(VideoModuleLoadTest, DriverDevice)
{
    std::ifstream in_file(server.GetLogFilePath().c_str());
    std::string line;
    std::string error_msg("Failed to load module");
    std::string param(GetParam());

    // grep for error message in the log file...
    error_msg +=  " \"" + param + "\"";
    if(in_file.is_open())
    {
        while (getline (in_file, line))
        {
            size_t found = line.find(error_msg);
            Bool error = (found != std::string::npos);
            ASSERT_FALSE (error) << "Module " << param << " failed to load" << std::endl << line <<  std::endl;
        }
    }
}

INSTANTIATE_TEST_CASE_P(, VideoModuleLoadTest,
                        ::testing::Values("ati", "cirrus", "dummy", "fbdev",
                                          "geode", "imx", "intel", "mga",
                                          "modesetting", "nv", "qxl",
                                          "r128", "rendition", "savage",
                                          "sis", "sisusb", "sunbw2",
                                          "sunleo", "tdfx", "vermilion",
                                          "vesa"));

int main(int argc, char **argv) {
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}