Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run tests with subst drive letters #4617

Open
StephanTLavavej opened this issue Apr 22, 2024 · 3 comments
Open

Unable to run tests with subst drive letters #4617

StephanTLavavej opened this issue Apr 22, 2024 · 3 comments
Labels
test Related to test code

Comments

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Apr 22, 2024

Encountered by @H-G-Hristov in #4611.

Possibly related to the codepaths that I changed in #4395.

Confirmed by @AlexGuteniev on Discord, quoting his repro:

C:\Project\STL\out\x64>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

C:\Project\STL\out\x64>subst D: C:\Project

C:\Project\STL\out\x64>D:

D:\>cd stl\out\x64

D:\STL\out\x64>python tests\utils\stl-lit\stl-lit.py ..\..\tests\std\tests\VSO_0000000_vector_algorithms -v
stl-lit.py: D:\STL\tests\std\lit.cfg:4: fatal: You seem to be running Lit directly -- you should be running Lit through <build>/tests/utils/stl-lit/stl-lit.py, which will ensure that the right Lit configuration file is used.
@StephanTLavavej StephanTLavavej added the test Related to test code label Apr 22, 2024
@AlexGuteniev
Copy link
Contributor

Possibly related to the codepaths that I changed in #4395.

No.

The problem is in generated Python script at out\x64\tests\utils\stl-lit\stl-lit.py:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===##

import os
import sys

config_map = {}

def map_config(source_dir, site_config):
    global config_map
    source_dir = os.path.realpath(source_dir)
    source_dir = os.path.normcase(source_dir)
    site_config = os.path.normpath(site_config)
    config_map[source_dir] = site_config

# Make sure we can find the lit package.
sys.path.insert(0, os.path.join("D:/STL/llvm-project/llvm", 'utils', 'lit'))

map_config("D:/STL/llvm-project/libcxx/test/lit.cfg.py", "D:/STL/out/x64/tests/libcxx/lit.site.cfg")
map_config("D:/STL/tests/libcxx/lit.cfg", "D:/STL/out/x64/tests/libcxx/lit.site.cfg")
map_config("D:/STL/tests/std/lit.cfg", "D:/STL/out/x64/tests/std/lit.site.cfg")
map_config("D:/STL/tests/tr1/lit.cfg", "D:/STL/out/x64/tests/tr1/lit.site.cfg")


builtin_parameters= {}
builtin_parameters['config_map'] = config_map

if __name__=='__main__':
    from lit.main import main
    main(builtin_parameters)

The paths like in map_config("D:/STL/llvm-project/libcxx/test/lit.cfg.py", "D:/STL/out/x64/tests/libcxx/lit.site.cfg") are substitute paths.

However, this operation source_dir = os.path.realpath(source_dir) converts them to unsubst paths.

Commenting this line out works around the issue.

@StephanTLavavej
Copy link
Member Author

Thanks! It seems like if one side is using the realpath transformation, then the other side should too.

@AlexGuteniev
Copy link
Contributor

Yes, but there are multiple "other sides". Changing site_config above to use realpath transformation isn't helpful, apparently should also use the transformations to paths that go as lookup values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Related to test code
Projects
None yet
Development

No branches or pull requests

2 participants