python / python/mypy

testing: tests for mypyc failed when gtest was installed on my system

Aperta
#9,812 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug topic-mypyc
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug Report

Within my fork of the mypy repo, the test mypyc/test/test_external.py failed while attempting to build libgtest.a with compilation errors like the following:

In file included from ../src/gtest-all.cc:42:
../src/gtest.cc:330:43: error: use of undeclared identifier 'GetArgvs'
static bool GTestIsInitialized() { return GetArgvs().size() > 0; }
                                          ^

To Reproduce

Run the tests as documented.

Expected Behavior

Ideally, compilation of the Google Test library should succeed, whether or not another version of Google Test is installed.

Actual Behavior

Compilation fails because the system-installed version of the header files are picked up. This is due to this line https://github.com/python/mypy/blob/05d9fb15dcec8bde4e7184ca387e7d8acea68792/mypyc/external/googletest/make/Makefile#L22 which adds the parent directory to the list of system includes. Running the compiler command with the -v option shows that the -I directives are then ignored, because they're seen as duplicates of the system paths.

Your Environment

My development environment is:
MacOS 10.15.7
Apple clang version 12
The latest commit in my clone of mypy is 05d9fb
brew install a recent version of Google Test.
Python interpreter version: 3.9

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con mypyc/test/test_external.py e mypyc/external/googletest/make/Makefile alla riga 22. Riproduci il test con un Google Test installato nel sistema, esamina il comando del compilatore e i percorsi di inclusione e conferma che la libreria Google Test venga compilata correttamente quando queste intestazioni sono installate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, python
Ambito
build-system, testing-qa
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.