From: Yu Watanabe Date: Thu, 20 Jul 2023 07:07:58 +0000 (+0900) Subject: test: use XDG_STATE_HOME for %S and %L X-Git-Tag: v254-rc3~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0efbe9b81cdae8544fbc58422f81513adc68d9a;p=thirdparty%2Fsystemd.git test: use XDG_STATE_HOME for %S and %L This fixes the test failure when invoked by a user. === Running ./systemd-tmpfiles --user on 'f /tmp/test-systemd-tmpfiles.1foag_ur/test-content.n_9r_xhm/arg - - - - %S' expect: '/home/watanabe/.config' actual: '/home/watanabe/.local/state' Traceback (most recent call last): File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 233, in test_valid_specifiers(user=True) File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 135, in test_valid_specifiers test_content('f {} - - - - %S', File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 88, in test_content assert content == expected ^^^^^^^^^^^^^^^^^^^ AssertionError === This also makes the test uses fallback paths. Follow-up for b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf. --- diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py index 369478d31ed..77ef53b9839 100755 --- a/test/test-systemd-tmpfiles.py +++ b/test/test-systemd-tmpfiles.py @@ -130,22 +130,23 @@ def test_valid_specifiers(*, user): xdg_runtime_dir if user else '/run', user=user) - xdg_config_home = os.getenv('XDG_CONFIG_HOME') - if xdg_config_home is not None or not user: - test_content('f {} - - - - %S', - xdg_config_home if user else '/var/lib', - user=user) + xdg_state_home = os.getenv('XDG_STATE_HOME') + if xdg_state_home is None and user: + xdg_state_home = os.path.join(home, ".local/state") + test_content('f {} - - - - %S', + xdg_state_home if user else '/var/lib', + user=user) xdg_cache_home = os.getenv('XDG_CACHE_HOME') - if xdg_cache_home is not None or not user: - test_content('f {} - - - - %C', - xdg_cache_home if user else '/var/cache', - user=user) - - if xdg_config_home is not None or not user: - test_content('f {} - - - - %L', - xdg_config_home + '/log' if user else '/var/log', - user=user) + if xdg_cache_home is None and user: + xdg_cache_home = os.path.join(home, ".cache") + test_content('f {} - - - - %C', + xdg_cache_home if user else '/var/cache', + user=user) + + test_content('f {} - - - - %L', + os.path.join(xdg_state_home, 'log') if user else '/var/log', + user=user) test_content('f {} - - - - %%', '%', user=user)