Skip to content

Commit

Permalink
(#23992) tinygltf: refactor test package
Browse files Browse the repository at this point in the history
  • Loading branch information
ErniGH authored May 15, 2024
1 parent 133dcd6 commit c275209
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
Binary file removed recipes/tinygltf/all/test_package/box01.glb
Binary file not shown.
3 changes: 1 addition & 2 deletions recipes/tinygltf/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ def build(self):
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
glb_path = os.path.join(self.source_folder, "box01.glb")
self.run(f"{bin_path} {glb_path}", env="conanrun")
self.run(bin_path, env="conanrun")
20 changes: 2 additions & 18 deletions recipes/tinygltf/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,13 @@
#include <string>

int main(int argc, char **argv) {
if (argc < 2) {
std::cerr << "Need at least one argument\n";
return 1;
}

tinygltf::Model model;
tinygltf::TinyGLTF loader;
std::string err;
std::string warn;
bool ret = loader.LoadBinaryFromFile(&model, &err, &warn, argv[1]);

if (!warn.empty()) {
printf("Warn: %s\n", warn.c_str());
}

if (!err.empty()) {
printf("Err: %s\n", err.c_str());
}

if (!ret) {
printf("Failed to parse glTF\n");
return -1;
}
bool ret = loader.LoadBinaryFromFile(&model, &err, &warn, "non_existent_file.glb");
printf("Test %d\n", ret);

return 0;
}
3 changes: 1 addition & 2 deletions recipes/tinygltf/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ def build(self):
def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
glb_path = os.path.join(self.source_folder, os.pardir, "test_package", "box01.glb")
self.run(f"{bin_path} {glb_path}", run_environment=True)
self.run(bin_path, run_environment=True)

0 comments on commit c275209

Please sign in to comment.