Skip to content

simtest: Don't depend on the environment variables of the caller - #464

Merged
sysstat merged 2 commits into
sysstat:masterfrom
sagaragas:fix/simtest-getenv-variables
Nov 15, 2026
Merged

sysstat merged 2 commits into
sysstat:masterfrom
sagaragas:fix/simtest-getenv-variables

Conversation

@sagaragas

@sagaragas sagaragas commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Some simulation tests fail when sysstat variables are set in the caller's environment. For example, with S_TIME_FORMAT=ISO exported, test 00192 fails on the date in the header:

-Linux 1.2.3-TEST (SYSSTAT.TEST) 	04/18/19 	_x86_64_	(9 CPU)
+Linux 1.2.3-TEST (SYSSTAT.TEST) 	2019-04-18 	_x86_64_	(9 CPU)

The tests that use --getenv only set some of the variables sar and sadf read, so the rest come from the caller. inisar (test 00750) always reads the environment, and sa2 (tests 00220 and 00225) doesn't initialize YESTERDAY, REPORTS or LONG_NAME.

I've set the missing variables to an empty value in those tests, like 00180 and 00190 already do for S_COLORS and S_TIME_FORMAT. tests/TLIST is updated to match, and the commit messages list which variable breaks which test.

The 00407 failure in CI is #465, not this change.

In test mode, the commands ignore the environment unless option
--getenv is used. The tests that use --getenv set only some of the
variables that sar and sadf read, and inisar (test 00750) always reads
the environment. So these tests fail when one of the other variables is
set in the environment of the user who runs do_test:

- S_COLORS=always: 00192 and 00750.
- S_TIME_FORMAT=ISO: 00192, 00555 and 00750.
- S_REPEAT_HEADER=2: 00180, 00184, 00188, 00190, 00191, 00193 and 00194.

Set these variables to an empty value in these tests, as tests 00180
and 00190 already do for S_COLORS and S_TIME_FORMAT. In these tests, an
empty value gives the same output as an unset variable. Update
tests/TLIST accordingly.
sa2 doesn't initialize YESTERDAY, REPORTS and LONG_NAME, and the
sysconfig files used by the tests don't set them. So sa2 takes them
from the caller's environment, and these values make tests 00220 and
00225 fail:

- YESTERDAY=no: 00220 and 00225.
- REPORTS=false: 00220 and 00225.
- LONG_NAME=y: 00220.

Set YESTERDAY and REPORTS to an empty value in both tests, and
LONG_NAME in test 00220. Test 00225 runs with -D in SADC_OPTIONS, so
sa2 sets LONG_NAME to y there anyway. Update tests/TLIST accordingly.
@sysstat
sysstat merged commit ac9a440 into sysstat:master Nov 15, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants