In Windows 8.1, Microsoft changed the behaviour of the GetVersionEx function so that it returns 6.2 (Windows 8) for applications without a compatibility manifest. (For applications with a compatibility manifest, it returns the version in that manifest.)
Two things:
a) Do you think we can add a unittest for this get_uname() function to test that the new table entries work and will work correctly?
b) Should we change Windows 8 to Windows 8 or later even tho the info remains the same? Could there be scripts that break on this?
Two things:
a) Do you think we can add a unittest for this get_uname() function to test that the new table entries work and will work correctly?
I don't think we can mock the Windows API function GetVersionEx(), so that makes it hard to unit test get_uname(). But we do call get_uname() as part of test_dir_formats().
We also call get_uname() every time tor is launched:
I added the missing Windows server versions, made the "or later" text automatic, and deleted some unreachable code.
The patch is bigger than I'd like to backport, but we can't report the correct Windows version without it. If you'd like, I can reduce the size of the patch by adding the unreachable pre-Windows 2000 code back in.
I think we can test get_uname() by making the unit tests print the Tor, OS, and library versions when they start. (And that's a nice feature.)
But I only want the Windows tests to print this log in the parent test process.
The parent/child flag is in tinytest.c, but the tor-specific code is in testing_common.c. How do I get access to the parent/child flag in testing_common.c ?
LGTM but what to do about the TODO: only print this in the main process on Windows,?
nickm will help some time this week.
Okay, here's a possibility. On Windows, when tinytest relaunches itself as a subprocess, it passes itself the --RUNNING-FORKED option. You could check for the presence of that option in argv, and use it to decide whether to log the version.
LGTM but what to do about the TODO: only print this in the main process on Windows,?
nickm will help some time this week.
Okay, here's a possibility. On Windows, when tinytest relaunches itself as a subprocess, it passes itself the --RUNNING-FORKED option. You could check for the presence of that option in argv, and use it to decide whether to log the version.
Ok, but:
The parent/child flag is in tinytest.c, but the tor-specific code is in testing_common.c. How do I get access to the parent/child flag in testing_common.c ?
Should I pass argv (or the flag) to testing_common.c, or include tor-specific code in tinytest.c?
Help with: - nickm, I would like help on how to access --RUNNING-FORKED in #28096. It seems to require an abstraction layer violation: argv isin tinytest.c, but tor code is in test_common.c. Is there some simple trick I'm missing? (So, IMO it would be okay to look at the "v" argument inmain in testing_common.c: it is argv. Yes, that's a layer violation,but tinytest is under our control anyway. Alternatively, we couldextend tinytest, I guess? I'll be around at the patch party time totalk more if it's helpful -nickm)