Skip to content

test_ppd_generator: give the printer-make-and-model checks a model - #96

Merged
tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
alepacheco:test-generator-make-model
Nov 2, 2026
Merged

tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
alepacheco:test-generator-make-model

Conversation

@alepacheco

Copy link
Copy Markdown
Contributor

As discussed on #94: this fixes the three printer-make-and-model checks in test_ppd_generator that #89 added ('\n', '"' and '\\'). They fail on every Build & Test leg on master.

ppdCreatePPDFromIPP2() cuts the make and model at the first control character or double quote before escaping. Each input ended up as a single word: "Acme", or "Acme\Model" in the backslash case. With no model part, the generator falls back to the make_model argument and then to "Unknown". So the Acme lines the checks look for are never written. The generated PPD never had an injected line; the inputs just needed a model.

Changes (test only, ppd/ppd-generator.c is untouched):

  • Each input now has a make and a model before its payload ("Acme Laser\n...", "Acme Laser\" ...", "Acme\\Model Laser").
  • Newline and quote: the checks verify that the value ends where it is cut (*Manufacturer: "Acme", *ModelName: "Acme Laser", *Product: "(Acme Laser)") and that none of the payload is written.
  • Backslash, which does reach ppd_escape_string(): the check verifies that it is doubled in *Manufacturer and *ModelName.
  • The comment above the group says which characters are cut and which are escaped.

make check passes (13/13), and test_ppd_generator also passes under ASan/UBSan. With master's test file, the same three checks fail as in CI.

The three printer-make-and-model checks added with ppd_escape_string()
in 0598346 (OpenPrinting#89) fail on every CI leg. ppdCreatePPDFromIPP2() cuts the
make and model at the first control character or double quote before
escaping, so their inputs end up as a single word ("Acme", or
"Acme\Model" in the backslash case). With no model part the generator
falls back to the make_model argument and then to "Unknown", and the
Acme lines the checks look for are never written.

Give each input a make and a model before its payload, and check what
the generator writes now: for the newline and the quote, that the value
ends where it is cut and nothing of the payload follows; for the
backslash, which reaches ppd_escape_string(), that it is doubled in
*Manufacturer and *ModelName. The generator itself is unchanged.
@tillkamppeter
tillkamppeter merged commit 30250e1 into OpenPrinting:master Nov 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants