FairRootGroup / FairMQ

C++ Message Queuing Library and Framework
GNU Lesser General Public License v3.0
87 stars 34 forks source link

Migrate to `std::filesystem` consistently #469

Closed dennisklein closed 1 year ago

dennisklein commented 1 year ago
[----------] 1 test from PropertyHelper
[ RUN      ] PropertyHelper.ConvertPropertyToString
/Users/alfaci/alfaci/workspace/FairRootGroup_FairMQ_PR-469/test/properties/_properties.cxx:215: Failure
Expected equality of these values:
  PropertyHelper::ConvertPropertyToString(Property(fs::path("C:\\Windows")))
    Which is: "\"C:\\\\Windows\""
  "\"C:\\Windows\""
/Users/alfaci/alfaci/workspace/FairRootGroup_FairMQ_PR-469/test/properties/_properties.cxx:234: Failure
Expected equality of these values:
  PropertyHelper::ConvertPropertyToString(Property(vector<fs::path>({ fs::path("C:\\Windows"), fs::path("C:\\Windows\\System32") })))
    Which is: "\"C:\\\\Windows\", \"C:\\\\Windows\\\\System32\""
  "\"C:\\Windows\", \"C:\\Windows\\System32\""
[  FAILED  ] PropertyHelper.ConvertPropertyToString (0 ms)
[----------] 1 test from PropertyHelper (0 ms total)

@rbx You can switch between boost::filesystem and std::filesystem now via -DFAIRMQ_HAS_STD_FILESYSTEM=0|1. (by default it is 1 if gcc >=9 or clang >= 9)

If I switch to boost, the test succeeds. So, they have the same API, but it produces different results... any idea? looks like escaping is somehow applied twice.

rbx commented 1 year ago

The difference seems to be how any_cast works with boost path and std path: https://godbolt.org/z/1YK8f4djW

dennisklein commented 1 year ago

The difference seems to be how any_cast works with boost path and std path: https://godbolt.org/z/1YK8f4djW

Hm, interesting. Well, I just adapted to test cases to expect different output for std::filesystem. Not sure, what else to do.

rbx commented 1 year ago

Here it says:

std::quoted is used so that spaces do not cause truncation when later read by stream input operator.

So I guess boost does not do the quoted part. It has nothing to do with any/any_cast afterall.

Hm, interesting. Well, I just adapted to test cases to expect different output for std::filesystem. Not sure, what else to do.

Yeah, let's leave it at that.