This is an archive of the discontinued LLVM Phabricator instance.

[test] Disable the Passes/PluginsTest cases on windows
ClosedPublic

Authored by mstorsjo on Feb 5 2020, 5:03 AM.

Details

Summary

The plugin expects to have undefined references to symbols exported by the loading process, which isn't supported by shared libraries on windows.

Just disable the whole directory unconditionally on Windows, as the test essentially is a no-op there anyway.

Diff Detail

Event Timeline

mstorsjo created this revision.Feb 5 2020, 5:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2020, 5:03 AM
Herald added a subscriber: mgorny. · View Herald Transcript
rnk added inline comments.Feb 5 2020, 4:14 PM
llvm/unittests/Passes/CMakeLists.txt
4–5

It seems there is some prior reason this is done this way, so that reconfiguring a build directory from BUILD_SHARED_LIBS=ON to OFF and back rebuilds the executable. Otherwise lit test discovery will find it.

To this point, I think we should simply disable this whole directory on Windows. (if (WIN32)) One cannot switch from win32 to non-win32 in the same directory and expect things to work.

mstorsjo updated this revision to Diff 242814.Feb 5 2020, 11:49 PM
mstorsjo marked an inline comment as done.
mstorsjo edited the summary of this revision. (Show Details)

Simplified the check to if (WIN32)

mstorsjo retitled this revision from [test] Disable the Passes/PluginsTest cases on windows with BUILD_SHARED_LIBS to [test] Disable the Passes/PluginsTest cases on windows.Feb 6 2020, 3:52 AM

Maybe only disable this in shared library builds?

Also, having a return() in a cmake file looks kind of gross to me. (It's a local statement but has a file-global effect, and it's easy to miss. In C, returns are super common, but in cmake they very much aren't [1]) Maybe wrap the rest of the file in the if instead?

1: git ls-files '*CMake*' | xargs rg -l 'return\('-- 1 occurrence in clang, 3 in llvm

Maybe only disable this in shared library builds?

That's what I did originally, but then @rnk suggested disabling it altogether, as there seemed to be existing efforts not to leave stale test executables if switching shared libs on/off

Also, having a return() in a cmake file looks kind of gross to me. (It's a local statement but has a file-global effect, and it's easy to miss. In C, returns are super common, but in cmake they very much aren't [1]) Maybe wrap the rest of the file in the if instead?

1: git ls-files '*CMake*' | xargs rg -l 'return\('-- 1 occurrence in clang, 3 in llvm

Sure, I could do that

mstorsjo updated this revision to Diff 243351.Feb 7 2020, 11:36 PM

Don't use return() on the file level

thakis accepted this revision.Feb 10 2020, 7:13 AM

Maybe only disable this in shared library builds?

That's what I did originally, but then @rnk suggested disabling it altogether, as there seemed to be existing efforts not to leave stale test executables if switching shared libs on/off

Hm, I'm aware of one patch fixing something like that (by rnk), but I'm also aware of all the target unittest binaries being wrong on arch changes (rg stale llvm/utils/gn/ finds one comment about being careful about getting it right, and one FIXME on where we don't). So I'm not sure I fully buy that :)

Anyhoo, if Reid likes it more this way, then let's do it.

But now that I look at the gn build files again, one of them is for this very directory, and it already does what the cmake file does after your patch. So maybe it used to be this way when I wrote the gn build file and then someone undid it?

Looks like I made the plugin link in Support in https://reviews.llvm.org/D47082 , then https://reviews.llvm.org/rL342150 (unreviewed?) undid that and broke Windows again.

Anyhoo, lgtm I suppose.

This revision is now accepted and ready to land.Feb 10 2020, 7:13 AM
This revision was automatically updated to reflect the committed changes.