<p><a href="https://github.com/openstreetmap/osm2pgsql/issues/490" class="issue-link" title="Regression tests missing default.style">#490</a></p>
<p>This patch solves the problem of missing files in tests.<br>
To run tests from any directory one need to add environment variable</p>
<pre><code>export TEST_DATA_DIR=/path/to/osm2pgsql_sources
</code></pre>
<p>(if the variable is not present, the tests will get data from current directory)</p>
<p>ctest did not need it, it had WORKING_DIRECTORY in it.<br>
If we want to just run executable without setting TEST_DATA_DIR, only auto-hardcoding in source can help. Will do it if really needed. </p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/osm2pgsql/pull/496'>https://github.com/openstreetmap/osm2pgsql/pull/496</a></p>
<h4>Commit Summary</h4>
<ul>
<li>change directory for tests if TEST_DATA_DIR is present</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-0">tests/CMakeLists.txt</a>
(2)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-1">tests/common-chdir.hpp</a>
(14)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-2">tests/test-hstore-match-only.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-3">tests/test-middle-flat.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-4">tests/test-middle-pgsql.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-5">tests/test-options-parse.cpp</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-6">tests/test-output-multi-line-storage.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-7">tests/test-output-multi-line.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-8">tests/test-output-multi-point-multi-table.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-9">tests/test-output-multi-point.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-10">tests/test-output-multi-poly-trivial.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-11">tests/test-output-multi-polygon.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-12">tests/test-output-multi-tags.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-13">tests/test-output-pgsql-schema.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-14">tests/test-output-pgsql-tablespace.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-15">tests/test-output-pgsql-z_order.cpp</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-16">tests/test-output-pgsql.cpp</a>
(2)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/osm2pgsql/pull/496/files#diff-17">tests/test-parse-xml2.cpp</a>
(4)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/osm2pgsql/pull/496.patch'>https://github.com/openstreetmap/osm2pgsql/pull/496.patch</a></li>
<li><a href='https://github.com/openstreetmap/osm2pgsql/pull/496.diff'>https://github.com/openstreetmap/osm2pgsql/pull/496.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/openstreetmap/osm2pgsql/pull/496">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AD2-7l68nDkRjkOpxmMzPNAMstPZo6-5ks5pCwxbgaJpZM4Gcax_.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/openstreetmap/osm2pgsql/pull/496"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>