Opened 14 months ago

Last modified 9 months ago

#31631 accepted enhancement

Write a test for round-trip encode/decode operations on configuration objects.

Reported by: nickm Owned by: nickm
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 042-deferred-20190918
Cc: nickm, teor, gaba Actual Points:
Parent ID: #29211 Points:
Reviewer: Sponsor:


We should have tests to round-trip through torrc, state, and sr_disk_state objects. We should make sure that encoding a configuration object and then parsing it again gives us the same result.

We might be able to turn this into a fuzzer test.

Child Tickets

Change History (7)

comment:1 Changed 14 months ago by teor

Yes, I think that the objects should be the same, even if the file content differs in in minor ways.

Maybe the fuzzer test could do file -> object -> file -> object, and then compare the objects.

comment:2 Changed 14 months ago by teor

Here's what I suggest:

  1. Run chutney on master
  2. Take copies of the torrc, state, and sr_disk_state files
  3. Run them through file -> object -> file
  4. Use the output files as inputs to unit tests
  5. Make the unit tests do file -> object -> file -> object
  6. Check that both files and both objects match
  7. If the files don't match, and the differences aren't meaningful, either:
    • mock the functions that return variable content, or
    • exclude the variable content from the test

comment:3 Changed 14 months ago by teor

The torrc test should also handle interactions between command-line, torrc, and defaults. And Option, +Option, and /Option. And maybe %include?

I opened #31637 for this test.

I don't know how to get sample files for this test. Maybe a small example is enough?

comment:4 Changed 14 months ago by nickm

Type: defectenhancement

Mark a number of current 0.4.2.x "defects" as "enhancements."

comment:5 Changed 14 months ago by nickm

Owner: set to nickm
Status: newaccepted

comment:6 Changed 13 months ago by nickm

Keywords: 042-deferred-20190918 added
Milestone: Tor: 0.4.2.x-finalTor: unspecified

Deferring various tickets from 0.4.2 to Unspecified.

comment:7 Changed 9 months ago by gaba

Sponsor: Sponsor31-can

No more sponsor 31. All this tickets remained open after sponsor 31 ended.

Note: See TracTickets for help on using tickets.