[PATCH xorg-gtest 1/3] Added --xorg-logfile option.

Chase Douglas chase.douglas at canonical.com
Mon Jan 30 18:33:22 PST 2012


On 01/30/2012 06:32 PM, Daniel d'Andrada wrote:
> And by default point to a location that doesn't require root privileges
> to be used. This is an enabler to make it possible to run Xorg without
> being root.
> 
> Signed-off-by: Daniel d'Andrada <daniel.dandrada at canonical.com>
> 
> diff --git a/include/xorg/gtest/environment.h 
> b/include/xorg/gtest/environment.h
> index fd550e7..65a28d5 100644
> --- a/include/xorg/gtest/environment.h
> +++ b/include/xorg/gtest/environment.h
> @@ -48,11 +48,13 @@ namespace testing {
>    * with the overall testing framework like
>    * @code
>    * std::string xorg_conf_path("conf/dummy.conf");
> + * std::string xorg_logfile_path("./MyXorg.log");
>    * int xorg_display = 133;
>    * std::string server("Xorg");
>    *
>    * xorg::testing::Environment* environment = new 
> xorg::testing::Environment(
>    *       xorg_conf_path,
> + *       xorg_logfile_path,
>    *       server,
>    *       xorg_display);
>    * testing::AddGlobalTestEnvironment(environment);
> @@ -64,10 +66,12 @@ class Environment : public ::testing::Environment {
>     /**
>      * Constructs an object to provide a global X server dummy environment.
>      * @param path_to_conf Path to xserver configuration.
> +   * @param path_to_logfile Path to xserver logfile.
>      * @param path_to_server Path to xserver executable.
>      * @param display Display port of dummy xserver instance.
>      */
>     Environment(const std::string& path_to_conf,
> +              const std::string& path_to_logfile = "/tmp/Xorg.GTest.log",
>                 const std::string& path_to_server = "Xorg", int display 

I thought about this some more, and I'm not sure I like adding an option
to the constructor. This will break API. Perhaps a better long-term
solution would be to leave the constructor as-is, and add properties to
the class instead.

Environment environment = new Environment("/etc/X11/gtest-dummy.conf");
environment->set_log_file("./MyXorg.log");
AddGlobalTestEnvironment(environment);

Before we have many users, perhaps we should convert all these
constructor parameters to properties?

-- Chase


More information about the xorg-devel mailing list