@@ -268,17 +268,24 @@ class UnitTests
268268 {
269269 validateUserSession ();
270270
271- auto [out, err] = LxsstuLaunchWslAndCaptureOutput (std::format (L" echo $DISPLAY" , LXSST_TEST_USERNAME));
271+ auto [out, err] = LxsstuLaunchWslAndCaptureOutput (std::format (L" --user {} echo $DISPLAY" , LXSST_TEST_USERNAME));
272272 VERIFY_ARE_EQUAL (out, L" \n " );
273+
274+ // N.B. The XDG_RUNTIME_DIR variable is always set by init even if gui apps are disabled.
275+ std::tie (out, err) = LxsstuLaunchWslAndCaptureOutput (std::format (L" --user {} echo $XDG_RUNTIME_DIR" , LXSST_TEST_USERNAME));
276+ VERIFY_ARE_EQUAL (out, std::format (L" /run/user/{}\n " , TestUid));
273277 }
274278
275279 // Validate user sessions state with gui apps enabled.
276280 {
277281 WslConfigChange config (LxssGenerateTestConfig ({.guiApplications = true }));
278282
279283 validateUserSession ();
280- auto [out, err] = LxsstuLaunchWslAndCaptureOutput (std::format (L" echo $DISPLAY" , LXSST_TEST_USERNAME));
284+ auto [out, err] = LxsstuLaunchWslAndCaptureOutput (std::format (L" --user {} echo $DISPLAY" , LXSST_TEST_USERNAME));
281285 VERIFY_ARE_EQUAL (out, L" :0\n " );
286+
287+ std::tie (out, err) = LxsstuLaunchWslAndCaptureOutput (std::format (L" --user {} echo $XDG_RUNTIME_DIR" , LXSST_TEST_USERNAME));
288+ VERIFY_ARE_EQUAL (out, std::format (L" /run/user/{}\n " , TestUid));
282289 }
283290
284291 // Create a 'broken' /run/user and validate that the warning is correctly displayed.
0 commit comments