Disable projfs_enumeration integration test if ntapi missing

Summary:
fbcode_builder doesn't currently know how to build a Python extension module,
which means the Windows oss build fails on trying to load ntapi if we don't
pass the `--no-tests` flag to getdeps.  Ideally we add extension module support
to the builder, but for now let's just disable the test case if the extension
module is unavailable.

Reviewed By: chadaustin

Differential Revision: D44804035

fbshipit-source-id: 10da54f6ea7d3699ac42421ee5cf57d883509bdd
This commit is contained in:
Mark Shroyer 2023-04-12 10:51:18 -07:00 committed by Facebook GitHub Bot
parent 57e7967e88
commit 52f68c1c1e
2 changed files with 31 additions and 5 deletions

View File

@ -286,6 +286,26 @@ if sys.platform != "win32":
}
)
def _have_ntapi_extension_module() -> bool:
if sys.platform != "win32":
return False
try:
from eden.integration.lib.ntapi import get_directory_entry_size # @nolint
return True
except ImportError:
return False
# ProjFS enumeration tests depend on a Python extension module, which may not be
# available with all build systems.
if not _have_ntapi_extension_module():
TEST_DISABLED.update(
{
"projfs_enumeration.ProjFSEnumeration": True,
"projfs_enumeration.ProjFSEnumerationInsufficientBuffer": True,
}
)
# We only run tests on linux currently, so we only need to disable them there.
if sys.platform.startswith("linux"):
# tests to skip on nfs, this list allows us to avoid writing the nfs postfix

View File

@ -10,11 +10,17 @@ from pathlib import Path
from .lib import testcase
if sys.platform == "win32":
from .lib.ntapi import (
get_directory_entry_size,
open_directory_handle,
query_directory_file_ex,
)
try:
from .lib.ntapi import (
get_directory_entry_size,
open_directory_handle,
query_directory_file_ex,
)
except ImportError:
# TODO(T150221518): We should add the ntapi extension module to the
# getdeps build, but for now we have to account for the possibility that
# it may not be present.
pass
SL_RESTART_SCAN = 0x00000001