Opened 13 days ago

Last modified 7 days 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: 0.4.2.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: nickm, teor, gaba Actual Points:
Parent ID: #29211 Points:
Reviewer: Sponsor: Sponsor31-can


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 (5)

comment:1 Changed 13 days 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 13 days 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 13 days 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 12 days ago by nickm

Type: defectenhancement

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

comment:5 Changed 7 days ago by nickm

Owner: set to nickm
Status: newaccepted
Note: See TracTickets for help on using tickets.