Skip to content

redirectIO helper function in ign_src_TEST.cc doesn't work on all platforms #214

@scpeters

Description

@scpeters

Environment

Description

The redirectIO helper function in ign_src_TEST.cc only appears to work on Windows. I noticed this after debugging a windows test failure introduced in #199. There is a console error message added in ign.cc when downloading worlds, and since the test expects no printing to std_err, this should trigger a test failure. It did trigger a test failure on windows, but not on Ubuntu or macOS / homebrew.

  • Expected behavior: redirectIO helper function should redirect IO on all platforms
  • Actual behavior: it only seems to work on Windows

Steps to reproduce

  1. build ign-fuel-tools4 branch at c680ee8
  2. run UNIT_ign_src_TEST
  3. it should fail due to an error message added in APIs for retrieving models in parallel #199 and print very little output to the screen

Output

In Windows CI from #213, the CollectionTest/DownloadCollectionTest.AllItems/0 test fails and has very little console output:

Build Status https://build.osrfoundation.org/job/ign_fuel-tools-pr-win/92/

7: [ RUN      ] CollectionTest/DownloadCollectionTest.AllItems/0
7: C:\Jenkins\workspace\ign_fuel-tools-pr-win\ws\ign-fuel-tools\src\ign_src_TEST.cc(495): error: Value of: stdErrBuffer.str().empty()
7:   Actual: false
7: Expected: true
7: �[31m[Err] [C:\Jenkins\workspace\ign_fuel-tools-pr-win\ws\ign-fuel-tools\src\ign.cc:641] �[m�[31mFailed to download worlds for collection [�[m�[31mTestCollection�[m�[31m]�[m�[31m
7: �[m
7: [  FAILED  ] CollectionTest/DownloadCollectionTest.AllItems/0, where GetParam() = 1 (6040 ms)

On may Mac laptop running the CollectionTest/DownloadCollectionTest.AllItems/0 test, it prints lots of output, including an ignerr message, but it doesn't fail:

[Err] [ign.cc:641] Failed to download worlds for collection [TestCollection]
[       OK ] CollectionTest/DownloadCollectionTest.AllItems/0 (8262 ms)
$ bin/UNIT_ign_src_TEST --gtest_filter="*AllItems/0"
Running main() from gtest_main.cc
Note: Google Test filter = *AllItems/0
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from CollectionTest/DownloadCollectionTest
[ RUN      ] CollectionTest/DownloadCollectionTest.AllItems/0
[Wrn] [Filesystem.cc:140] The path [test_cache] does not refer to a directory nor to a file
[Dbg] [ModelIter.cc:201] Got response [{"errcode":3017,"msg":"Page not found","extra":null,"errid":"9c2ae5be-3ce6-4220-8b74-5fc85f661db8","route":"GET /1.0/OpenRobotics%2Fcollections%2FTestCollection%2Fmodels?page=2","user-agent":"FuelTools 4.4.0","remote-address":"73.222.22.243"}
]
[Msg] Found 2 models in collection [TestCollection]
[Dbg] [WorldIter.cc:169] Got response [[{"createdAt":"2020-08-10T18:33:13Z","updatedAt":"2021-11-07T05:51:58Z","name":"Test world 2","owner":"OpenRobotics","description":"Used by automated testing.\r\n\r\n`.world` extension is deprecated, `.sdf` added on 2020/08/11","likes":0,"downloads":10540,"filesize":6571,"upload_date":"2020-08-10T18:33:12Z","modify_date":"2020-08-11T17:05:22Z","license_id":1,"license_name":"Creative Commons Zero v1.0 Universal","license_url":"https://creativecommons.org/publicdomain/zero/1.0/","license_image":"https://i.creativecommons.org/p/88x31.png","permission":0,"thumbnail_url":"/OpenRobotics/worlds/Test%20world%202/tip/files/thumbnails/1.png","private":false,"tags":["test"]},{"createdAt":"2020-06-10T23:56:27Z","updatedAt":"2021-11-07T05:52:02Z","name":"Test world","owner":"OpenRobotics","description":"Used by automated testing\r\n\r\n`.world` extension is deprecated, `.sdf` added on 2020/08/11","likes":0,"downloads":16579,"filesize":6571,"upload_date":"2020-06-10T23:56:26Z","modify_date":"2020-08-11T17:07:02Z","license_id":1,"license_name":"Creative Commons Zero v1.0 Universal","license_url":"https://creativecommons.org/publicdomain/zero/1.0/","license_image":"https://i.creativecommons.org/p/88x31.png","permission":0,"thumbnail_url":"/OpenRobotics/worlds/Test%20world/tip/files/thumbnails/1.png","private":false,"tags":["test"]}]
]
[Msg] Found 2 worlds in collection [TestCollection]
[Msg] Preparing to download 2 models with 1 worker threads
[Msg] Downloading model [https://fuel.ignitionrobotics.org/openrobotics/models/teambase]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/materials/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/materials/textures/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/materials/textures/antenna.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/materials/textures/tent.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/meshes/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/meshes/antenna.dae]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/meshes/tent.dae]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/model.config]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/model.sdf]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/1.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/2.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/3.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/4.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/teambase/2/thumbnails/5.png]
[Msg] Downloading model [https://fuel.ignitionrobotics.org/openrobotics/models/backpack]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/materials/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/materials/textures/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/materials/textures/Backpack.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/meshes/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/meshes/Backpack.dae]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/model.config]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/model.sdf]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/1.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/2.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/3.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/4.png]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/models/backpack/2/thumbnails/5.png]
[Dbg] [LocalCache.cc:601] Model [backpack] loading resource from another model, named [Backpack]. On Blueprint (ign-fuel-tools 3) and Citadel (ign-fuel-tools 4), [Backpack] is ignored. From Dome (ign-fuel-tools 5), [backpack] will be used. If [Backpack] is not a model belonging to owner [openrobotics], fix your SDF file!
[Dbg] [LocalCache.cc:601] Model [backpack] loading resource from another model, named [Backpack]. On Blueprint (ign-fuel-tools 3) and Citadel (ign-fuel-tools 4), [Backpack] is ignored. From Dome (ign-fuel-tools 5), [backpack] will be used. If [Backpack] is not a model belonging to owner [openrobotics], fix your SDF file!
[Msg] Finished, downloaded 2 models in total
[Msg] Using 1 jobs to download collection of 2 items
[Msg] Downloading world [fuel.ignitionrobotics.org/openrobotics/worlds/test world 2]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world 2/2/test.sdf]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world 2/2/test.world]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world 2/2/thumbnails/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world 2/2/thumbnails/1.png]
[Msg] Saved world at:
  test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world 2/2
[Msg] Downloaded: 1 / 2
[Msg] Downloading world [fuel.ignitionrobotics.org/openrobotics/worlds/test world]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world/2/test.sdf]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world/2/test.world]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world/2/thumbnails/]
[Dbg] [Zip.cc:173] Created file [test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world/2/thumbnails/1.png]
[Msg] Saved world at:
  test_cache/fuel.ignitionrobotics.org/openrobotics/worlds/test world/2
[Msg] Downloaded: 2 / 2
[Err] [ign.cc:641] Failed to download worlds for collection [TestCollection]
[       OK ] CollectionTest/DownloadCollectionTest.AllItems/0 (8262 ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtestsBroken or missing tests / testing infra

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions