Opened 8 years ago

Closed 8 years ago

#6406 closed defect (fixed)

test failure: ogr_libkml_write_model might be a issue in ogr/ogr_libkml.py

Reported by: rashadkm Owned by: warmerdam
Priority: normal Milestone:
Component: Autotest Version: svn-trunk
Severity: normal Keywords: testsuite, libkml
Cc:

Description

there is a single test failure from libkml testsuite in gdal. Name of the test is ogr_libkml_write_model. Looking at ogr/ogr_libkml.py code I think it could be a minor bug.

gdaltest.gdalurlopen(
'http://makc.googlecode.com/svn/trunk/flash/sandy_flar2/cube.dae') 

return a handle when I run the code. It returns None only when an exception is raised.

A fix would be trivial in this case like:

if gdaltest.gdalurlopen(
'http://makc.googlecode.com/svn/trunk/flash/sandy_flar2/cube.dae') is None:

Below is the part of output from python run_all.py ogr.

  TEST: ogr_libkml_write_model ... <?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document id="root_doc">
    <Document id="test">
      <name>test</name>
      <Placemark id="test.1">
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location>
            <longitude>2</longitude>
            <latitude>49</latitude>
            <altitude>10</altitude>
          </Location>
          <Orientation>
            <heading>-70</heading>
            <tilt>75</tilt>
            <roll>10</roll>
          </Orientation>
          <Scale>
            <x>2</x>
            <y>3</y>
            <z>4</z>
          </Scale>
          <Link>
            <href>http://makc.googlecode.com/svn/trunk/flash/sandy_flar2/cube.dae</href>
          </Link>
        </Model>
      </Placemark>
      <Placemark id="test.2">
        <Model>
          <Location>
            <longitude>2</longitude>
            <latitude>49</latitude>
          </Location>
          <Scale>
            <x>1</x>
            <y>1</y>
            <z>1</z>
          </Scale>
          <Link>
            <href>http://foo</href>
          </Link>
        </Model>
      </Placemark>
    </Document>
  </Document>
</kml>

fail
    line 1313: failure
  TEST: ogr_libkml_read_write_style ... success

Change History (5)

comment:1 by Even Rouault, 8 years ago

I think the test is correct in its intent, but perhaps not perfect. The intent is when the http://makc.googlecode.com/svn/trunk/flash/sandy_flar2/cube.dae ressource is unavailable from the LIBKML driver to not error out because <targetHref>http://makc.googlecode.com/svn/trunk/flash/sandy_flar2/cube.gif</targetHref> will then be missing.

Now you can perhaps still get an error if the ressource isn't available from GDAL code which uses curl, but if it is available from Python (which uses ???? for its network access).

comment:2 by rashadkm, 8 years ago

So IIUC, it doesn't matter what gdaltest.gdalurlopen( ) return. It should also check if gdal is built with curl support. Is that correct?

comment:3 by Even Rouault, 8 years ago

Ah your GDAL is build without curl support ? OK that might explain indeed.

I see other tests depending on GDAL being built with Curl use "if gdal.GetDriverByName('HTTP') is None:" to detect if it is absent

in reply to:  3 comment:4 by rashadkm, 8 years ago

Replying to rouault:

Ah your GDAL is build without curl support ? OK that might explain indeed.

I see other tests depending on GDAL being built with Curl use "if gdal.GetDriverByName('HTTP') is None:" to detect if it is absent

I can confirm that building gdal with curl have the above test passed. So I think the check for http will make the test correct and perfect.

comment:5 by Even Rouault, 8 years ago

Component: defaultAutotest
Resolution: fixed
Status: newclosed

trunk r33703 "Fix ogr_libkml_write_model test to avoid failing when GDAL is built without curl support (#6406)"

Note: See TracTickets for help on using tickets.