<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>ok, I've looked a bit at the code</p>
<p>So I believe the issue is that</p>
<p>-
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/master/apps/test_ogrsf.cpp#L1064">https://github.com/OSGeo/gdal/blob/master/apps/test_ogrsf.cpp#L1064</a>
forms a "/foo/test.pol" filename for the miramon driver and call
Create() with it<br>
</p>
<p>- and then
<a class="moz-txt-link-freetext" href="https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L207">https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L207</a>
"osPath = CPLGetPath(pszRootName);" sets "/foo/" as osPath, which
is then passed to VSIMkdir(), and causing the following mess</p>
<p>I suspect the VSIMkdir() call should only be done in the branch
<a class="moz-txt-link-freetext" href="https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L211">https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L211</a>
where pszRootName has an empty extension.<br>
</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 11/03/2024 à 17:30, Abel Pau a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:PAXPR07MB77755303FCDB5E4BD9995983A2242@PAXPR07MB7775.eurprd07.prod.outlook.com">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<div class="WordSection1">
<p class="MsoNormal"><span lang="ES">Hi,</span></p>
<p class="MsoNormal"><span lang="ES"> </span></p>
<p class="MsoNormal"><span lang="EN-US">going back to the
misterious failing
</span><span lang="EN-US">test_tiff_write_133 I am not able to
understand what is wrong with that.</span></p>
<p class="MsoNormal"><span lang="EN-US">It seems that it would
be failing when writing to an unauthorized path. But instead
of that it is not failing (and this is the failure, not
failing when it should fail).</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"># Test writing into a
non authorized file</span></p>
<p class="MsoNormal"><span lang="EN-US">ds =
gdaltest.tiff_drv.Create(</span></p>
<p class="MsoNormal"><span lang="EN-US"> "/foo/bar", 1024,
1000, 3, options=["STREAMABLE_OUTPUT=YES", "BLOCKYSIZE=1"]</span></p>
<p class="MsoNormal"><span lang="EN-US">)</span></p>
<p class="MsoNormal"><span lang="EN-US">assert ds is None</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">So, there is anything I
am missing about that?<br>
The actions that informs that is re-runed in debug mode:</span></p>
<p class="MsoNormal"><a
href="https://github.com/AbelPau/gdal/actions/runs/8234751437/job/22520988179"
moz-do-not-send="true">Merge from base ·
AbelPau/gdal@3ec4655 (github.com)</a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="ES">FAILED
gcore/tiff_write.py::test_tiff_write_133 - AssertionError:
assert <osgeo.gdal.Dataset; proxy of <Swig Object of
type 'GDALDatasetShadow *' at 0x0000022226FEDE30> > is
None</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">It’s not None X-(</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Perhaps I, as Even said,
I created a path before? But how to delete that? I don’t use
anymore:
</span>VSIMkdirRecursive(). I use VSIMkdir()<span lang="EN-US"></span></p>
<p class="MsoNormal"><b><span lang="EN-US">Perhaps if the
destination folder doesn’t exist I should NOT create it
and return a FAILURE?</span></b></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span lang="ES">De:</span></b><span
lang="ES"> Abel Pau <a class="moz-txt-link-rfc2396E" href="mailto:a.pau@creaf.uab.cat"><a.pau@creaf.uab.cat></a>
<br>
<b>Enviado el:</b> dimecres, 6 de març de 2024 16:24<br>
<b>Para:</b> Abel Pau <a class="moz-txt-link-rfc2396E" href="mailto:a.pau@creaf.uab.cat"><a.pau@creaf.uab.cat></a>; Even
Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Asunto:</b> RE: [gdal-dev] Testing the driver</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">Hi,</span></p>
<p class="MsoNormal"><span lang="EN-US">It seems nothing
changes. I understand that the environment is new and the
execution is not related with the last one.</span></p>
<p class="MsoNormal"><span lang="EN-US">Here there are 5 tests
that fail..</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Any idea of what can be
happening?</span></p>
<p class="MsoNormal"><span lang="EN-US">They are very unrelated
</span></p>
<p class="MsoNormal"><a
href="https://github.com/AbelPau/gdal/actions/runs/8172351502/job/22342474513"
moz-do-not-send="true">Bye VSIMkdirRecursive() ·
AbelPau/gdal@646b98b (github.com)</a><span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span lang="ES">De:</span></b><span
lang="ES"> gdal-dev <<a
href="mailto:gdal-dev-bounces@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev-bounces@lists.osgeo.org</a>>
<b>En nombre de </b>Abel Pau via gdal-dev<br>
<b>Enviado el:</b> dimecres, 6 de març de 2024 13:52<br>
<b>Para:</b> Even Rouault <<a
href="mailto:even.rouault@spatialys.com"
moz-do-not-send="true" class="moz-txt-link-freetext">even.rouault@spatialys.com</a>>;
<a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
<b>Asunto:</b> Re: [gdal-dev] Testing the driver</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">Ok, I ‘ve changed that.
Let’s see if it’s the problem.</span></p>
<p class="MsoNormal"><span lang="EN-US">It’s all so delicate :)</span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks again!</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span lang="ES">De:</span></b><span
lang="ES"> Even Rouault <<a
href="mailto:even.rouault@spatialys.com"
moz-do-not-send="true" class="moz-txt-link-freetext">even.rouault@spatialys.com</a>>
<br>
<b>Enviado el:</b> dimecres, 6 de març de 2024 13:36<br>
<b>Para:</b> Abel Pau <<a
href="mailto:a.pau@creaf.uab.cat"
moz-do-not-send="true" class="moz-txt-link-freetext">a.pau@creaf.uab.cat</a>>;
<a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
<b>Asunto:</b> Re: [gdal-dev] Testing the driver</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p> </p>
<div>
<p class="MsoNormal">Le 06/03/2024 à 13:14, Abel Pau a écrit :</p>
</div>
<blockquote>
<p class="MsoNormal"><span lang="EN-US">Hi Even,</span></p>
<p class="MsoNormal"><span lang="EN-US">I finally discovered
the error. It was the fixture. In the wrong place.</span></p>
<p class="MsoNormal"><span lang="EN-US">Now I’m creating the
test.</span></p>
<p class="MsoNormal"><span lang="EN-US">I hope finish it soon.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">On the other hand,</span></p>
<p class="MsoNormal"><span lang="EN-US">in my actions tab: </span>
<a
href="https://github.com/AbelPau/gdal/actions/runs/8169099745/job/22332488002"
moz-do-not-send="true">Merge branch 'OSGeo:master' into
master · AbelPau/gdal@0249b6d (github.com)</a></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">There are some tiff failures, but nothing
on my hand about tiff.</p>
<p class="MsoNormal"><span lang="ES">==================================
FAILURES ===================================
</span></p>
<p class="MsoNormal"><span lang="EN-US">36:
_____________________________ test_tiff_write_133
_____________________________
</span></p>
<p class="MsoNormal"><span lang="EN-US">36: </span></p>
<p class="MsoNormal"><span lang="EN-US">36: def
test_tiff_write_133():</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Do you know what it
can be?</span></p>
</blockquote>
<p>There are sometimes random failures, but here it fails on
both the build-windows-msys2-mingw and build-windows-conda
configs . I would suspect this might be a side effect of a
previous run of the Miramon driver by another test with an
invalid filename such as /foo/bar. Actually I see that
test_ogrsf tries to create a /foo/test file.</p>
<p>And <a
href="https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L219"
moz-do-not-send="true" class="moz-txt-link-freetext">
https://github.com/AbelPau/gdal/blob/master/ogr/ogrsf_frmts/miramon/ogrmiramondatasource.cpp#L219</a>
does a VSIMkdirRecursive(), so it must create a "/foo"
directory. I would recommend against using VSIMkdirRecursive()
in a driver. You might use VSIMkdir() to create the latest
level of directory, but creating the whole hiearchy is
granting too much power to a driver.</p>
<p>Even</p>
<blockquote>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span lang="ES">De:</span></b><span
lang="ES"> Even Rouault
<a href="mailto:even.rouault@spatialys.com"
moz-do-not-send="true"><even.rouault@spatialys.com></a>
<br>
<b>Enviado el:</b> dimecres, 6 de març de 2024 13:09<br>
<b>Para:</b> Abel Pau <a
href="mailto:a.pau@creaf.uab.cat"
moz-do-not-send="true"><a.pau@creaf.uab.cat></a>;
<a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
<b>Asunto:</b> Re: [gdal-dev] Testing the driver</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p>Hi,</p>
<p>I don't see anything wrong. I've tried that on my native
Linux build and the test_ogr_miramon_vector_1() is found.
Does
<span lang="EN-US">"pytest autotest/ogr/ogr_basic_test.py"
work?*</span></p>
<p><span lang="EN-US">Note: you don't need the try / except in
your test case unless you'd need to some particular
cleanup, but that's not the case here. pytest handles test
failures nicely</span></p>
<p><span lang="EN-US">Even</span></p>
<div>
<p class="MsoNormal">Le 05/03/2024 à 22:28, Abel Pau via
gdal-dev a écrit :</p>
</div>
<blockquote>
<p class="MsoNormal"><span lang="ES">Hi again,</span></p>
<p class="MsoNormal"><span lang="EN-US">after solving some
issues I used WSL (Windows subsystem Linux) to create an
environment where I am able to run tests.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I run the cmake
inside build folder in the environment. It’s slow but
finally it finish. After cmake --build . --target
install all is ready to be tested.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I create a simple
test ogr_miramon_vector.py (see the code below) to prove
that it’s reliable.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I run:</span></p>
<p class="MsoNormal"><span lang="EN-US">pytest
autotest/ogr/ogr_miramon_vector.py</span></p>
<p class="MsoNormal"><span lang="EN-US">and:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">apau@ABEL2:/mnt/d/GitHub-repository/gdal/build$
pytest autotest/ogr/ogr_miramon_vector.py</span></p>
<p class="MsoNormal"><span lang="EN-US">Test session starts
(platform: linux, Python 3.8.10, pytest 8.0.2,
pytest-sugar 1.0.0)</span></p>
<p class="MsoNormal"><span lang="EN-US">benchmark: 4.0.0
(defaults: timer=time.perf_counter disable_gc=False
min_rounds=5 min_time=0.000005 max_time=1.0
calibration_precision=10 warmup=False
warmup_iterations=100000)</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL Build Info:</span></p>
<p class="MsoNormal"><span lang="EN-US"> PAM_ENABLED: YES</span></p>
<p class="MsoNormal"><span lang="EN-US"> OGR_ENABLED: YES</span></p>
<p class="MsoNormal"><span lang="EN-US"> CURL_ENABLED: YES</span></p>
<p class="MsoNormal"><span lang="EN-US"> CURL_VERSION:
7.68.0</span></p>
<p class="MsoNormal"><span lang="EN-US"> GEOS_ENABLED: YES</span></p>
<p class="MsoNormal"><span lang="EN-US"> GEOS_VERSION:
3.8.0-CAPI-1.13.1</span></p>
<p class="MsoNormal"><span lang="EN-US">
PROJ_BUILD_VERSION: 6.3.1</span></p>
<p class="MsoNormal"><span lang="EN-US">
PROJ_RUNTIME_VERSION: 6.3.1</span></p>
<p class="MsoNormal"><span lang="EN-US"> COMPILER: GCC
9.4.0</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL_DOWNLOAD_TEST_DATA:
undefined (tests relying on downloaded data may be
skipped)</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL_RUN_SLOW_TESTS:
undefined (tests marked as "slow" will be skipped)</span></p>
<p class="MsoNormal"><span lang="EN-US">rootdir:
/mnt/d/GitHub-repository/gdal/build/autotest</span></p>
<p class="MsoNormal"><span lang="EN-US">configfile:
pytest.ini</span></p>
<p class="MsoNormal"><span lang="EN-US">plugins:
benchmark-4.0.0, sugar-1.0.0, env-1.1.3</span></p>
<p class="MsoNormal"><b><span lang="EN-US">collected 0 items</span></b></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">My questions is why
it seems it’s not working?</span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks!</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The test:</span></p>
<p class="MsoNormal"><span lang="EN-US">-------------</span></p>
<p class="MsoNormal"><span lang="EN-US">import os</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">import gdaltest</span></p>
<p class="MsoNormal"><span lang="EN-US">import ogrtest</span></p>
<p class="MsoNormal"><span lang="EN-US">import pytest</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">from osgeo import
gdal, ogr, osr</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">pytestmark =
pytest.mark.require_driver("MiraMonVector")</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">###############################################################################</span></p>
<p class="MsoNormal"><span lang="EN-US">@pytest.fixture(scope="module",
autouse=True)</span></p>
<p class="MsoNormal"><span lang="EN-US">def init():</span></p>
<p class="MsoNormal"><span lang="EN-US"> with
gdaltest.config_option("CPL_DEBUG", "ON"):</span></p>
<p class="MsoNormal"><span lang="EN-US"> yield</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">###############################################################################</span></p>
<p class="MsoNormal"><span lang="EN-US"># basic test </span>
</p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">def
test_ogr_miramon_vector_1():</span></p>
<p class="MsoNormal"><span lang="EN-US"> try:</span></p>
<p class="MsoNormal"><span lang="EN-US"> ds =
gdal.OpenEx("data/miramon/Points/SimplePoints/SimplePointsFile.pnt")</span></p>
<p class="MsoNormal"><span lang="EN-US"> lyr =
ds.GetLayer(0)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> assert lyr
is not None, "Failed to get layer"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
lyr.GetFeatureCount() == 3</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
lyr.GetGeomType() == ogr.wkbPoint</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> f =
lyr.GetNextFeature()</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
f.GetFID() == 0</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
f.GetGeometryRef().ExportToWkt() == "POINT (513.49
848.81)"</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
f.GetField("ID_GRAFIC") == "0"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> f =
lyr.GetNextFeature()</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
f.GetField("ID_GRAFIC") == "1"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> f =
lyr.GetNextFeature()</span></p>
<p class="MsoNormal"><span lang="EN-US"> assert
f.GetField("ID_GRAFIC") == "2"</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> ds = None</span></p>
<p class="MsoNormal"><span lang="EN-US"> except Exception
as e:</span></p>
<p class="MsoNormal"><span lang="EN-US">
pytest.fail(f"Test failed with exception: {e}")</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span lang="ES">De:</span></b><span
lang="ES"> Even Rouault
<a href="mailto:%3ceven.rouault@spatialys.com%3e"
moz-do-not-send="true"><even.rouault@spatialys.com></a>
<br>
<b>Enviado el:</b> divendres, 9 de febrer de 2024
11:48<br>
<b>Para:</b> Abel Pau <a
href="mailto:a.pau@creaf.uab.cat"
moz-do-not-send="true"><a.pau@creaf.uab.cat></a>;
<a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
<b>Asunto:</b> Re: [gdal-dev] Testing the driver</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p>Abel,</p>
<div>
<p class="MsoNormal">Le 09/02/2024 à 10:55, Abel Pau via
gdal-dev a écrit :</p>
</div>
<blockquote>
<p class="MsoNormal"><span lang="EN-US">Hi,</span></p>
<p class="MsoNormal"><span lang="EN-US">I am at the lasts
steps before pulling a request about the MiraMon
driver.
<br>
I need to write some documentation and formalize the
tests. </span></p>
<p class="MsoNormal"><span lang="EN-US">After that, I’ll
do the pull request to github.</span></p>
</blockquote>
<p class="MsoNormal"><span>I'd suggest first before issuing
the pull request that you push to your fork on github
and look at the Actions tab. That will allow you to fix
a lot of things on your side, before issuing the PR
itself<br>
<br>
</span></p>
<blockquote>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I am a little
confused about the testing. I can use pytest or ctest,
right? Which is the favourite? Are there any changes
from the official documentation?</span></p>
</blockquote>
<p>ctest is just the CMake way of launching the test suite.
It will execute C++ tests of autotest/cpp directly, and
for tests written in python will launch "pytest
autotest/XXXXX" for each directory.
</p>
<p>"ctest --test-dir $build_dir -R autotest_ogr -V" will
just run all the autotest/ogr tests, which can be quite
long already.</p>
<p>To test your own development, you may have a more
pleasant experience by directly running just the tests for
your driver with something like "pytest
autotest/ogr/ogr_miramon.py" (be careful on Windows, the
content of $build_dir/autotest is copied from
$source_dir/autotest each time "cmake" is run, so if you
edit your test .py file directly in the build directory,
be super careful of not accidentally losing your work, and
make sure to copy its content to the source directory
first. That's admittedly an annoying point of the current
test setup on Windows, compared to Unix where we use
symbolic links)</p>
<p>after setting the environment to have PYTHONPATH point to
something like $build_dir/swig/python/Release or
$build_dir/swig/python/Debug (I believe you're on
Windows?). If you look at the first lines output by the
above "ctest --test-dir $build_dir -R autotest_ogr -V"
invokation, you'll actually see the PYTHONPATH value to
specify.</p>
<p>You also need to first install pytest and other testing
dependencies with: python -m pip install
autotest/requirements.txt</p>
<blockquote>
<p class="MsoNormal"><span lang="EN-US">There is a minimal
test to create?</span></p>
</blockquote>
<p class="MsoNormal"><span>A maximal test suite, you mean
;-) You should aim for a "reasonable" coverage of the
code you wrote. Aiming to test the nominal code paths of
your driver is desirable (testing the error cases
generally requires a lot more effort).
<br>
<br>
</span></p>
<blockquote>
<p class="MsoNormal"><span lang="EN-US">Can you recommend
me some driver that tests things like:</span></p>
<p class="MsoListParagraph"><span>1.<span>
</span></span><span lang="EN-US">Read a
point/arc/polygon layer from some format (gml,kml,
gpckg,..) and assert the number of readed objectes</span></p>
<p class="MsoListParagraph"><span>2.<span>
</span></span><span lang="EN-US">Read a point layer
and assert some points (3d included) and some of the
fields values</span></p>
<p class="MsoListParagraph"><span>3.<span>
</span></span><span lang="EN-US">The same with arcs
and polygons</span></p>
<p class="MsoListParagraph"><span>4.<span>
</span></span><span lang="EN-US">Create some layer
from the own format to anothers and compare the
results with some “good” results.</span></p>
<p class="MsoListParagraph"><span>5.<span>
</span></span><span lang="EN-US">Create multiple
layers from one outer format (like gpx) and verify the
name of the created files...</span></p>
</blockquote>
<p>You don't necessarily need to use other formats. It is
actually better if the tests of a format don't depend too
much on other formats, to keep things isolated.</p>
<p>To test the read part of your driver, add a
autotest/ogr/data/miramon directory with *small* test
files, ideally at most a few KB each to keep the size of
the GDAL repository reasonable, and a few features in each
is often enough to unit test, with different type of
geometries, attributes, and use the OGR Python API to open
the file and iterate over its layers and features to check
their content. Those files should have ideally be produced
by the Miramon software and not by the writing side of
your driver, to check the interoperability of your driver
with a "reference" software.</p>
<p>For the write site of the driver, you can for example run
gdal.VectorTranslate(dest, source) on those files, and use
again the test function to validate that the read side of
your driver likes what the write site has produced. An
alternative is also to do a binary comparison of the file
generated by your driver with a reference test file stored
in for example autotest/ogr/data/miramon/ref_output. But
this may be sometimes a fragile approach if the output of
your driver might change in the future (would require
regenerating the reference test files).</p>
<p>I'd suggest your test suite also has a test that runs the
"test_ogrsf" command line utility which is a kind of
compliance test suite which checks a number of
expectations for a driver, like that GetFeatureCount()
returns the same number as iterating with
GetNextFeature(), etc etc</p>
<p>It is difficult to point at a "reference" test suite, as
all drivers have their particularities and may need
specific tests. Potential sources of inspirations:</p>
<p>- autotest/ogr/ogr_gtfs.py . Shows very simple testing
of the read side of a driver, and includes a test_ogrsf
test</p>
<p>- autotest/ogr/ogr_csv.py has examples where the writing
side of the driver is checked by opening the output file
and checking that some strings are present in it (only
easily doable with text based formats)</p>
<p>- autotest/ogr/ogr_openfilegdb_write.py . Extensive
testing of the writing side of a driver . A lot in it will
be specific to the format and irrelevant to your concern,
but you should at least find all possible aspects of how
to test the write side of a driver.</p>
<p class="MsoNormal"><span>Even
</span></p>
<pre>-- </pre>
<pre><a href="http://www.spatialys.com"
moz-do-not-send="true" class="moz-txt-link-freetext">http://www.spatialys.com</a></pre>
<pre>My software is free, but my time generally not.</pre>
<p class="MsoNormal"> </p>
<pre>_______________________________________________</pre>
<pre>gdal-dev mailing list</pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a></pre>
<pre><a
href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<pre>-- </pre>
<pre><a href="http://www.spatialys.com" moz-do-not-send="true"
class="moz-txt-link-freetext">http://www.spatialys.com</a></pre>
<pre>My software is free, but my time generally not.</pre>
</blockquote>
<pre>-- </pre>
<pre><a href="http://www.spatialys.com" moz-do-not-send="true"
class="moz-txt-link-freetext">http://www.spatialys.com</a></pre>
<pre>My software is free, but my time generally not.</pre>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>