VirtualBox

Changeset 102913 in vbox


Ignore:
Timestamp:
Jan 17, 2024 10:35:52 AM (12 months ago)
Author:
vboxsync
Message:

Frontends/VBoxShell: Added linting support to the Makefile.

Location:
trunk/src/VBox/Frontends/VBoxShell
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/Config.kmk

    r102798 r102913  
    11# $Id$
    22## @file
    3 # kBuild Configuration file for the VirtualBox Validation Kit.
     3# kBuild Configuration file for VBoxShell.
    44#
    55
    66#
    7 # Copyright (C) 2010-2023 Oracle and/or its affiliates.
     7# Copyright (C) 2024 Oracle and/or its affiliates.
    88#
    99# This file is part of VirtualBox base platform packages, as
     
    3535#
    3636
    37 VBOX_VALIDATIONKIT_CONFIG_KMK_INCLUDED = 1
     37VBOX_VBOXSHELL_CONFIG_KMK_INCLUDED = 1
    3838
    3939# Include the top-level configure file.
     
    4545# Globals
    4646#
    47 VBOX_PATH_VALIDATIONKIT_SRC := $(PATH_ROOT)/src/VBox/ValidationKit
    48 
     47VBOX_PATH_VBOXSHELL_SRC := $(PATH_ROOT)/src/VBox/Frontends/VBoxShell
    4948
    5049#
    51 # Base template for Validation Kit R3 programs that drops the -static flag since we only want to use the
    52 # static version of our own libraries and not the system libs.
     50# List of python sources that should be linted.
    5351#
    54 TEMPLATE_VBoxValidationKitR3Base = VBox Validation Kit ring-3 program base, both guest and host.
    55 TEMPLATE_VBoxValidationKitR3Base_EXTENDS = VBoxR3Static
    56 ifeq ($(KBUILD_TARGET),win)
    57  TEMPLATE_VBoxValidationKitR3Base_LDFLAGS         = $(filter-out -IntegrityCheck, $(TEMPLATE_VBoxR3Static_LDFLAGS))
    58 else ifn1of ($(KBUILD_TARGET), darwin solaris win)
    59  TEMPLATE_VBoxValidationKitR3Base_CFLAGS          = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CFLAGS))
    60  TEMPLATE_VBoxValidationKitR3Base_CXXFLAGS        = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CXXFLAGS))
    61  TEMPLATE_VBoxValidationKitR3Base_OBJCFLAGS       = $(filter-out -static, $(TEMPLATE_VBoxR3Static_OBJCFLAGS))
    62  TEMPLATE_VBoxValidationKitR3Base_LDFLAGS         = $(filter-out -static, $(TEMPLATE_VBoxR3Static_LDFLAGS))
    63 endif
    64 TEMPLATE_VBoxValidationKitR3Base_DEFS = $(filter-out VBOX_WITH_DTRACE,$(TEMPLATE_VBoxR3Static_DEFS))
    65 TEMPLATE_VBoxValidationKitR3Base_LIBS = $(TEMPLATE_VBoxR3Static_LIBS)
    66 if1of ($(KBUILD_TARGET), linux)
    67  if $(VBOX_GCC_VERSION_CXX) < 40800
    68   TEMPLATE_VBoxValidationKitR3Base_LIBS += supc++
    69   TEMPLATE_VBoxValidationKitR3Base_LDTOOL = $(subst GXX,GCC,$(TEMPLATE_VBoxR3Static_TOOL))
    70  endif
    71 endif
    72 TEMPLATE_VBoxValidationKitR3Base_LDFLAGS.darwin = $(TEMPLATE_VBoxR3Static_LDFLAGS.darwin) -framework IOKit
    73 
    74 
    75 #
    76 # Template for building ring-3 programs for the Validation Kit.
    77 # These programs can run on any host or guest.
    78 #
    79 TEMPLATE_VBoxValidationKitR3 = VBox Validation Kit ring-3 program, both guest and host.
    80 TEMPLATE_VBoxValidationKitR3_EXTENDS = VBoxValidationKitR3Base
    81 TEMPLATE_VBoxValidationKitR3_EXTENDS_BY = appending
    82 TEMPLATE_VBoxValidationKitR3_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
    83 TEMPLATE_VBoxValidationKitR3_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBoxNtDll
    84 TEMPLATE_VBoxValidationKitR3_DEFS = IN_RT_R3
    85 TEMPLATE_VBoxValidationKitR3_LIBS.darwin = iconv
    86 TEMPLATE_VBoxValidationKitR3_LIBS.freebsd = iconv
    87 TEMPLATE_VBoxValidationKitR3_LIBS = \
    88         $(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
    89 ifeq ($(KBUILD_TARGET),solaris)
    90  TEMPLATE_VBoxValidationKitR3_LIBS += \
    91         kstat \
    92         nsl \
    93         contract
    94  if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
    95   TEMPLATE_VBoxValidationKitR3_LIBS += \
    96         smbios
    97  endif
    98 endif
    99 ifneq ($(KBUILD_TARGET),win)
    100  TEMPLATE_VBoxValidationKitR3_LIBS += \
    101         $(SDK_VBoxZlib_LIBS)
    102 endif
    103 
    104 # Make VCC100 output work on NT3.x, NT4, W2K, XP and W2K3.
    105 ifndef VBOX_WITH_NOCRT_STATIC
    106  TEMPLATE_VBoxValidationKitR3_LIBS.win.x86 = \
    107         $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/oldnames.lib \
    108         $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
    109         $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
    110         $(PATH_STAGE_LIB)/RuntimeR3VccTricks$(VBOX_SUFF_LIB)
    111  TEMPLATE_VBoxValidationKitR3_LDFLAGS.win.x86 = \
    112         -Include:_vcc100_shell32_fakes_cpp \
    113         -Include:_vcc100_shell32_fakes_asm \
    114         -Section:.bss,RW!K
    115 endif
    116 TEMPLATE_VBoxValidationKitR3_LDFLAGS.win.x86 += -NoOptIData
    117 TEMPLATE_VBoxValidationKitR3_POST_CMDS.win.x86   = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB))$(TEMPLATE_VBoxValidationKitR3Base_POST_CMDS.win.x86)$$(NLTAB)
    118 TEMPLATE_VBoxValidationKitR3_POST_CMDS.win.amd64 = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB))$(TEMPLATE_VBoxValidationKitR3Base_POST_CMDS.win.amd64)$$(NLTAB)
    119 TEMPLATE_VBoxValidationKitR3_LNK_DEPS.win.x86    = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION)) $(TEMPLATE_VBoxValidationKitR3Base_LNK_DEPS.win.x86)
    120 TEMPLATE_VBoxValidationKitR3_LNK_DEPS.win.amd64  = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION)) $(TEMPLATE_VBoxValidationKitR3Base_LNK_DEPS.win.amd64)
    121 
    122 #TODO: TEMPLATE_VBoxValidationKitR3_EXTENDS = VBoxGuestR3Exe
    123 
    124 TEMPLATE_VBoxValidationKitR3_USES.win += vboximportchecker
    125 TEMPLATE_VBoxValidationKitR3_VBOX_IMPORT_CHECKER.win.x86   = nt31
    126 TEMPLATE_VBoxValidationKitR3_VBOX_IMPORT_CHECKER.win.amd64 = xp64
    127 
    128 
    129 #
    130 # Template for ring-3 testcases to be included on the Validation Kit .ISO.
    131 #
    132 # Needed for running the ring-3 testcases on older guests (like NT4 / XP).
    133 # Those testcases then run as part of the Validation Kit and are included on the Validation Kit .ISO.
    134 # See @bugref:10195.
    135 #
    136 TEMPLATE_VBoxValidationKitR3TstExe         = VBox Ring 3 Testcase Exe for Validation Kit .ISO
    137 TEMPLATE_VBoxValidationKitR3TstExe_EXTENDS = VBoxValidationKitR3
    138 TEMPLATE_VBoxValidationKitR3TstExe_INST    = $(INST_VALIDATIONKIT)/testcase/$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/testcase/
    139 
    140 
    141 #
    142 # Template for building ring-3 programs for the Validation Kit.
    143 # When these programs run on the host they may take advantage of the
    144 # support driver if installed.
    145 #
    146 TEMPLATE_VBoxValidationKitR3SupDrv = VBox Validation Kit ring-3 program, mainly host.
    147 TEMPLATE_VBoxValidationKitR3SupDrv_EXTENDS = VBoxValidationKitR3
    148 TEMPLATE_VBoxValidationKitR3SupDrv_EXTENDS_BY = appending
    149 TEMPLATE_VBoxValidationKitR3SupDrv_DEFS = IN_SUP_R3
    150 TEMPLATE_VBoxValidationKitR3SupDrv_LIBS = \
    151         $(PATH_STAGE_LIB)/SUPR3Static$(VBOX_SUFF_LIB) \
    152         $(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
    153 ifndef VBOX_WITH_NOCRT_STATIC
    154  TEMPLATE_VBoxValidationKitR3SupDrv_LDFLAGS.win.x86 = \
    155         -Include:_vcc100_ntdll_fakes_cpp \
    156         -Include:_vcc100_ntdll_fakes_asm
    157 endif
    158 
    159 #
    160 # Template for building agnostic ring-0 host modules for the Validation Kit.
    161 #
    162 TEMPLATE_VBoxValidationKitR0 = VBox Validation Kit agnostic ring-0 host module.
    163 TEMPLATE_VBoxValidationKitR0_EXTENDS = VBoxR0
    164 TEMPLATE_VBoxValidationKitR0_EXTENDS_BY = appending
    165 TEMPLATE_VBoxValidationKitR0_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
    166 TEMPLATE_VBoxValidationKitR0_DEFS = IN_RT_R0
    167 TEMPLATE_VBoxValidationKitR0_LIBS = \
    168         $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB) \
    169         $(VBOX_LIB_SUPR0)
    170 
    171 #
    172 # List of python sources that should be linted and unittested.
    173 #
    174 VBOX_VALIDATIONKIT_PYTHON_SOURCES     :=
    175 VBOX_VALIDATIONKIT_PYLINT_TARGETS     :=
    176 VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE :=
     52VBOX_VBOXSHELL_PYTHON_SOURCES     :=
     53VBOX_VBOXSHELL_PYLINT_TARGETS     :=
    17754
    17855ifdef VBOX_WITH_PYLINT
     
    18461#
    18562if1of ($(KBUILD_TARGET), win os2)
    186  VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH);$(VBOX_PATH_VALIDATIONKIT_SRC);$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript;$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager;$(VBOX_PATH_VALIDATIONKIT_SRC)/tests/additions;$(VBOX_PATH_VALIDATIONKIT_SRC)/../VMM/VMMAll
     63 VBOX_PYTHONPATH_VBOXSHELL = $(PYTHONPATH);$(VBOX_PATH_VBOXSHELL_SRC)
    18764else
    188  VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH):$(VBOX_PATH_VALIDATIONKIT_SRC):$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript:$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager:$(VBOX_PATH_VALIDATIONKIT_SRC)/tests/additions:$(VBOX_PATH_VALIDATIONKIT_SRC)/../VMM/VMMAll
     65 VBOX_PYTHONPATH_VBOXSHELL = $(PYTHONPATH):$(VBOX_PATH_VBOXSHELL_SRC)
    18966endif
    190 BLDDIRS += $(PATH_TARGET)/pylint $(PATH_TARGET)/pyunittest
     67BLDDIRS += $(PATH_TARGET)/pylint
    19168
    192 define def_vbox_validationkit_py_check
     69define def_vbox_vboxshell_py_check
    19370 $(eval name:=$(basename $(notdir $(py))))
    19471
     
    19875 ifdef VBOX_WITH_PYLINT
    19976        $(QUIET2)$(call MSG_L1,Subjecting $(py) to pylint...)
    200         $(QUIET)$(REDIRECT) -C "$(dir $(py))" -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -- \
    201                 $(VBOX_PYLINT) --rcfile=$(VBOX_PATH_VALIDATIONKIT_SRC)/pylintrc $$(VBOX_PYLINT_FLAGS) $$($(py)_VBOX_PYLINT_FLAGS) ./$(notdir $(py))
     77        $(QUIET)$(REDIRECT) -C "$(dir $(py))" -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VBOXSHELL)" -- \
     78                $(VBOX_PYLINT) --rcfile=$(VBOX_PATH_VBOXSHELL_SRC)/pylintrc $$(VBOX_PYLINT_FLAGS) $$($(py)_VBOX_PYLINT_FLAGS) ./$(notdir $(py))
    20279 endif
    20380        $(QUIET)$(APPEND) -t "$(PATH_TARGET)/pylint/$(name).o"
    204 
    205  ifn1of ($(py), $(VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE))
    206   pyunittest: $(name)-pyunittest.o
    207   $(PATH_TARGET)/pyunittest/$(name).o $(name)-pyunittest.o:: $(py) | $(PATH_TARGET)/pyunittest/
    208         $(QUIET2)$(call MSG_L1,Unittesting Python source $(py)...)
    209         $(QUIET)$(REDIRECT) -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -C $(dir $(py)) \
    210                 -- $(VBOX_UNITTEST_PYTHON) -m unittest -v $(notdir $(basename $(py)))
    211         $(QUIET)$(APPEND) -t "$(PATH_TARGET)/pyunittest/$(name).o"
    212   VBOX_VALIDATIONKIT_PYUNITTEST_TARGETS += $(PATH_TARGET)/pyunittest/$(name).o
    213 
    214   TESTING += $(name)-pyunittest.o
    215  endif
    21681 TESTING += $(name)-py-phony.o
    217  VBOX_VALIDATIONKIT_PYLINT_TARGETS    += $(PATH_TARGET)/pylint/$(name).o
    218 endef # def_vbox_validationkit_py_check
     82 VBOX_VBOXSHELL_PYLINT_TARGETS    += $(PATH_TARGET)/pylint/$(name).o
     83endef # def_vbox_vboxshell_py_check
    21984
    22085
    221 define def_vbox_validationkit_process_python_sources
     86define def_vbox_vboxshell_process_python_sources
    22287 if $(words $(_SUB_MAKEFILE_STACK)) <= 0 || "$1" == "FORCE"
    223   $(foreach py, $(VBOX_VALIDATIONKIT_PYTHON_SOURCES), $(eval $(def_vbox_validationkit_py_check)))
     88  $(foreach py, $(VBOX_VBOXSHELL_PYTHON_SOURCES), $(eval $(def_vbox_vboxshell_py_check)))
    22489 endif
    22590endef
    226 
    227 
    228 
    229 #
    230 # http://www.jshint.com
    231 #
    232 VBOX_JSHINT       ?= jshint
    233 VBOX_JSHINT_FLAGS := --config $(VBOX_PATH_VALIDATIONKIT_SRC)/jshintrc.js --verbose
    234 ifndef VBOX_WITH_JSHINT
    235  VBOX_WITH_JSHINT := $(which $(VBOX_JSHINT))
    236 endif
    237 
    238 #
    239 # List of javascript sources that should be checked and linted.
    240 #
    241 VBOX_VALIDATIONKIT_JS_SOURCES :=
    242 
    243 define def_vbox_validationkit_js_check
    244  $(eval name:=$(basename $(notdir $(js))))
    245  $(name).o $(name).obj: # $(PATH_SUB_CURRENT)/$(js)
    246         -$(REDIRECT) -E LC_ALL=C  -C $(dir $(js)) -- $$(VBOX_JSHINT) ./$(notdir $(js)) $$(VBOX_JSHINT_FLAGS)
    247  jslint: $(name).o
    248 endef
    249 
    250 ifdef VBOX_WITH_JSHINT
    251  define def_vbox_validationkit_process_js_sources
    252   if $(words $(_SUB_MAKEFILE_STACK)) <= 0
    253    $(foreach js, $(VBOX_VALIDATIONKIT_JS_SOURCES), $(eval $(def_vbox_validationkit_js_check)))
    254   endif
    255  endef
    256 endif
    257 
    258 
    259 #
    260 # List of IPRT testcases that will be included in the ValKit.
    261 #
    262 ifdef VBOX_WITH_VALIDATIONKIT_UNITTESTS_PACKING
    263  VALKIT_UNITTESTS_WHITELIST_IPRT := \
    264         tstFile \
    265         tstFileLock \
    266         tstRTPathQueryInfo \
    267         tstRTPipe \
    268         tstRTProcCreateEx \
    269         tstRTProcCreatePrf \
    270         tstRTProcQueryUsername \
    271         tstThread-1 \
    272         tstUtf8
    273 
    274  VALKIT_UNITTESTS_WHITELIST_IPRT.linux += \
    275         tstRTProcWait \
    276         tstRTProcIsRunningByName
    277 
    278  VALKIT_UNITTESTS_WHITELIST_IPRT.win += \
    279         tstRTProcWait
    280 
    281 endif # VBOX_WITH_VALIDATIONKIT_UNITTESTS_PACKING
    282 
  • trunk/src/VBox/Frontends/VBoxShell/Makefile.kmk

    r98412 r102913  
    2929include $(KBUILD_PATH)/subheader.kmk
    3030
     31include $(PATH_SUB_CURRENT)/Config.kmk
     32
    3133INSTALLS += VBoxShell
    3234VBoxShell_INST = $(INST_SDK)/bindings/
     
    3638        vboxinfo.vb=>mscom/vb/sample/vboxinfo.vb
    3739
     40#
     41# Automatically lint VBoxShell.
     42#
     43if defined(VBOX_WITH_PYLINT) && !defined(VBOX_WITHOUT_AUTO_PYLINT)
     44 OTHERS      += $(PATH_TARGET)/pylintVBoxShell.run
     45 OTHER_CLEAN += $(PATH_TARGET)/pylintVBoxShell.run
     46 $(PATH_TARGET)/pylintVBoxShell.run: vboxshell.py
     47        $(QUIET)$(APPEND) -t "$@"
     48endif
    3849
     50VBOX_VBOXSHELL_PYTHON_SOURCES := $(wildcard $(PATH_SUB_CURRENT)/*.py)
    3951
     52$(evalcall def_vbox_vboxshell_process_python_sources,FORCE)
    4053include $(FILE_KBUILD_SUB_FOOTER)
    41 
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette