mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
integration: make tests compatible on Windows
Summary: The changes in this diff makes the code to "run" and skip correctly according to our rules. All integration tests are now runnable on Windows with mode/win Differential Revision: D30143255 fbshipit-source-id: b2ddbff7268f182274b3755f4b28df6ac6cdeef4
This commit is contained in:
parent
2c7092ce43
commit
c9c33ac3b8
@ -4,9 +4,7 @@
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2.
|
||||
|
||||
import grp
|
||||
import os
|
||||
import pwd
|
||||
|
||||
from .lib import repobase, testcase
|
||||
|
||||
@ -33,6 +31,9 @@ class ChownTest(testcase.EdenRepoTest):
|
||||
return self.create_hg_repo("main")
|
||||
|
||||
def setup_eden_test(self) -> None:
|
||||
import grp
|
||||
import pwd
|
||||
|
||||
super().setup_eden_test()
|
||||
self.nobody_uid = pwd.getpwnam("nobody").pw_uid
|
||||
self.nobody_gid = grp.getgrnam("nobody").gr_gid
|
||||
|
@ -7,11 +7,18 @@
|
||||
import os
|
||||
import os.path
|
||||
import pathlib
|
||||
import platform
|
||||
import unittest
|
||||
|
||||
from .lib.linux import LinuxCgroup, is_cgroup_v2_mounted
|
||||
from .lib.testcase import IntegrationTestCase
|
||||
|
||||
if platform.system() != "Windows":
|
||||
from .lib.linux import LinuxCgroup, is_cgroup_v2_mounted
|
||||
else:
|
||||
|
||||
def is_cgroup_v2_mounted():
|
||||
return False
|
||||
|
||||
|
||||
class LinuxCgroupTest(IntegrationTestCase):
|
||||
def test_parse_proc_file(self) -> None:
|
||||
|
@ -7,6 +7,7 @@
|
||||
import ctypes
|
||||
import mmap
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
from ctypes import c_int, c_size_t, c_ssize_t, c_void_p
|
||||
|
||||
@ -18,14 +19,16 @@ from .lib import testcase
|
||||
#
|
||||
# We have to ignore type errors on the next line until we update to a version
|
||||
# of typeshed that includes https://github.com/python/typeshed/pull/3945
|
||||
libc = ctypes.CDLL(None)
|
||||
c_off_t = c_ssize_t
|
||||
libc = None
|
||||
if platform.system() != "Windows":
|
||||
libc = ctypes.CDLL(None)
|
||||
c_off_t = c_ssize_t
|
||||
|
||||
libc.mmap.argtypes = [c_void_p, c_size_t, c_int, c_int, c_off_t]
|
||||
libc.mmap.restype = ctypes.POINTER(ctypes.c_byte)
|
||||
libc.mmap.argtypes = [c_void_p, c_size_t, c_int, c_int, c_off_t]
|
||||
libc.mmap.restype = ctypes.POINTER(ctypes.c_byte)
|
||||
|
||||
libc.munmap.restype = c_void_p
|
||||
libc.munmap.argtypes = [c_void_p, c_size_t]
|
||||
libc.munmap.restype = c_void_p
|
||||
libc.munmap.argtypes = [c_void_p, c_size_t]
|
||||
|
||||
|
||||
@testcase.eden_repo_test
|
||||
|
@ -5,7 +5,6 @@
|
||||
# GNU General Public License version 2.
|
||||
|
||||
import os
|
||||
import resource
|
||||
import signal
|
||||
import sys
|
||||
import threading
|
||||
@ -34,6 +33,8 @@ class TakeoverTest(testcase.EdenRepoTest):
|
||||
enable_fault_injection: bool = True
|
||||
|
||||
def populate_repo(self) -> None:
|
||||
import resource
|
||||
|
||||
self.pagesize = resource.getpagesize()
|
||||
self.page1 = "1" * self.pagesize
|
||||
self.page2 = "2" * self.pagesize
|
||||
|
Loading…
Reference in New Issue
Block a user