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

aida: <p>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 <code>python3 test/run_test.py</code>, I get <code>fatal error: 'tmp.h' file not found</code>.</p>
<p>I looked for the <code>#include &lt;tmp.h&gt;</code> statement, and I found it in <code>test/cpp_extensions/extension.cpp</code> with the comment <code>// test include_dirs in setuptools.setup with relative path</code>. I don’t see the actual <code>tmp.h</code> 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.</p>
<p>I can run individual tests, like <code>test/test_jit.py</code> without any problems.</p>
<p>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.</p>
<p>Thanks for helping me with such a basic question!</p>

ptrblck: <p>Thanks for taking a shot at a potential bug fix. <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>
<p>What’s the fix you are working on? Could you post the link to your branch or issue?</p>
<p>Depending what methods you’ve changed in your fix, you might just be able to ignore other test failures.<br>
E.g. if <code>cpp_extensions</code> 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.</p>

aida: <p>The issue is <a href="https://github.com/pytorch/pytorch/issues/41772" rel="nofollow noopener">here</a>. It seemed like an easy fix to me: If I go into <a href="https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/core/type.cpp#L12" rel="nofollow noopener">the <code>operator&lt;&lt;</code> override in types.cpp</a>, I can just add/change some logic to create the format suggested in <span class="hashtag">#41772</span>.</p>
<p>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 <code>test/test_jit.py</code> - we will need to update all the failing tests as well.” So,  part of the issue is fixing any relevant tests.</p>
<p>Since I posted my issue yesterday, I’ve come to a slightly better understanding of how <code>run_test.py</code> works. I see where in the code the <code>tmp</code> directory is made, and I’m able to move further in the right direction by putting a few tests (e.g. <code>test_cpp_extensions_aot_no_ninja</code>) after the <code>--exclude</code> option. I still have a lot of questions, though…I installed Ninja per the PyTorch build instructions, so why is <code>test_cpp_extensions_aot_no_ninja</code> even being called? Is it okay to just exclude tests like this if it seems like they’re not relevant to my fix?</p>
<p>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 <a href="https://github.com/pytorch/pytorch#from-source" rel="nofollow noopener">here</a>, replacing any instances of <code>install</code> with <code>develop</code>. 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!</p>

ptrblck: <p>Thanks for the link.<br>
If breaking the test is expected, they shouldn’t be ignored of course. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>
<p>I assume <code>test_cpp_extensions_aot_no_ninja</code> is forcefully disabling <code>ninja</code> even if it’s installed, so it might be still a valid test.</p>
<p>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.</p>