Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend PDF-based tests to dvips #278

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/tl_packages
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ tex
xetex
# Requirements for the tests
amsfonts
dvips
etex-pkg
l3experimental
latex-lab
pdfmanagement-testphase
Comment on lines +17 to +19
Copy link
Contributor Author

@muzimuzhi muzimuzhi Feb 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these three packages too experimental to cause less stable test output files?

#
# Support for typesetting the docs
#
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ jobs:
package_file: .github/tl_packages
- name: Run l3build
run: texlua l3build.lua ctan -H --show-log-on-error
- name: Archive failed tests
if: failure()
uses: actions/upload-artifact@v3
with:
name: l3build-test-diff
path: |
build/test*/*.diff
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ this project uses date-based 'snapshot' version identifiers.

## [Unreleased]

### Added
- Force non-Windows diff program to consider all files to be text files
- Extend PDF-based tests to `dvips`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does l3build test changes need to be listed in CHANGELOG?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean - that the change may require .tlg updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes only involving "using l3build to test l3build itself"

- Normalize a new pattern of PDF stream

### Fixed
- Restore epoch settings for `dvitopdf()`
- Use plural form of variable `ps2pdfopts` consistently in code and doc, and
Expand Down
10 changes: 10 additions & 0 deletions build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ bundle = ""
-- Non-standard settings
checkconfigs = {"build", "config-pdf", "config-plain"}
checkdeps = { }
--[[ FIXME:
- setting specialformats in config-pdf.lua results in "binary" set to "latexdvips" (should be "latex")
- setting specialformats in build.lua disables specifying engine
l3build save -c config-pdf -e latexdvips 00-test-2
]]
specialformats = specialformats or {}
specialformats["latex"] = specialformats["latex"] or
{
latexdvips = {binary = "latex", format = ""}
}
Comment on lines +10 to +19
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the wired limitations are caused by some l3build problems, but for now let's just use a way that "works".

checkengines = {"pdftex", "xetex", "luatex", "ptex", "uptex"}
cleanfiles = {"*.pdf", "*.tex", "*.zip"}
exefiles = {"l3build.lua"}
Expand Down
6 changes: 4 additions & 2 deletions config-pdf.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
checkengines = {"pdftex", "xetex"}
testfiledir = "testfiles-pdf"
checkengines = {"pdftex", "xetex", "latexdvips"}
testfiledir = "testfiles-pdf"

ps2pdfopts = " -dCompressStreams=false "
5 changes: 5 additions & 0 deletions l3build-check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ local function normalize_pdf(content)
binary = false
stream = true
stream_content = "stream" .. os_newline
elseif match(line, "/Length %d+>>stream$") then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ">>stream$" is enough, but I chose a more strict pattern, mainly to not match a non-stream.

binary = false
stream = true
stream_content = "stream" .. os_newline
new_content = new_content .. gsub(line, "stream$", "") .. os_newline
elseif not match(line, "^ *$") and
not match(line,"^%%%%Invocation") and
not match(line,"^%%%%%+") then
Expand Down
4 changes: 3 additions & 1 deletion l3build-file-functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ os_ascii = "echo \"\""
os_cmpexe = getenv("cmpexe") or "cmp"
os_cmpext = getenv("cmpext") or ".cmp"
os_diffext = getenv("diffext") or ".diff"
os_diffexe = getenv("diffexe") or "diff -c --strip-trailing-cr"
-- "-a, --text": force diff to consider all files to be text files
-- https://www.gnu.org/software/diffutils/manual/html_node/Binary.html
os_diffexe = getenv("diffexe") or "diff -ac --strip-trailing-cr"
os_grepexe = "grep"
os_newline = "\n"

Expand Down
1 change: 1 addition & 0 deletions l3build-typesetting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ end

function dvitopdf(name, dir, engine, hide)
runcmd(
-- dvips respects epoch settings, but ps2pdf (ghostscript) doesn't
set_epoch_cmd(epoch, forcecheckepoch) ..
"dvips " .. name .. dviext
.. (hide and (" > " .. os_null) or "")
Expand Down
Loading