<tmp.h> missing when running test/run_test.py

I’m a student who’s never contributed to open source before, but I found an open issue that I’d like to submit a fix for! However, when I run the entire test suit using python3 test/run_test.py, I get fatal error: 'tmp.h' file not found.

I looked for the #include <tmp.h> statement, and I found it in test/cpp_extensions/extension.cpp with the comment // test include_dirs in setuptools.setup with relative path. I don’t see the actual tmp.h file anywhere in PyTorch, though. I assume that means it’s somehow created as a temporary file during the build, but I don’t see where in the test code the file should be created.

I can run individual tests, like test/test_jit.py without any problems.

I’ve tried using the zsh shell in VSCode (version 1.47.0) as well as simply opening the zsh in a separate window on my MacBook (macOS Catalina 10.15.5). I followed the PyTorch build instructions exactly, and I didn’t seem to have any problems during the actual installation itself.

Thanks for helping me with such a basic question!

Thanks for taking a shot at a potential bug fix. :slight_smile:

What’s the fix you are working on? Could you post the link to your branch or issue?

Depending what methods you’ve changed in your fix, you might just be able to ignore other test failures.
E.g. if cpp_extensions is failing, while you’ve changed a sentence in the docs, I wouldn’t care too much about it and let the CI run all the tests in its setup.

The issue is here. It seemed like an easy fix to me: If I go into the operator<< override in types.cpp, I can just add/change some logic to create the format suggested in #41772.

The original post says “The change should be made in both IRPrinter and IRParser, since there are tests checking that we can parse what we print. It is expected that such change would break lots of tests, for instance test/test_jit.py - we will need to update all the failing tests as well.” So, part of the issue is fixing any relevant tests.

Since I posted my issue yesterday, I’ve come to a slightly better understanding of how run_test.py works. I see where in the code the tmp directory is made, and I’m able to move further in the right direction by putting a few tests (e.g. test_cpp_extensions_aot_no_ninja) after the --exclude option. I still have a lot of questions, though…I installed Ninja per the PyTorch build instructions, so why is test_cpp_extensions_aot_no_ninja even being called? Is it okay to just exclude tests like this if it seems like they’re not relevant to my fix?

Also, another issue: I can’t finish running the test suite on my MacBook even with some tests excluded. Python maxes out the CPU and the program shuts down. I followed the installation steps for Mac here, replacing any instances of install with develop. Is there something else you need to do to physically run the tests? (I’ve read some stuff about ssh-ing into a remote GPU, but that seemed kind of extreme.) If so, I’d love to add some extra info to the documentation!

Thanks for the link.
If breaking the test is expected, they shouldn’t be ignored of course. :wink:

I assume test_cpp_extensions_aot_no_ninja is forcefully disabling ninja even if it’s installed, so it might be still a valid test.

I’m not familiar with MacOS, but if you cannot run all tests (and don’t have a GPU to run the whole test stack), you could use the CI for it, which would be executed in your PR for the fix.