diff --git a/services/clsi/app/js/LatexRunner.js b/services/clsi/app/js/LatexRunner.js index 323bd01456..0f875966eb 100644 --- a/services/clsi/app/js/LatexRunner.js +++ b/services/clsi/app/js/LatexRunner.js @@ -87,7 +87,9 @@ function runLatex(projectId, options, callback) { } // number of latex runs and whether there were errors const runs = - output?.stdout?.match(/^Run number \d+ of .*latex/gm)?.length || 0 + output?.stdout?.match(/^Run number \d+ of .*latex/gm)?.length || // TeXLive 2022 and later + output?.stderr?.match(/^Run number \d+ of .*latex/gm)?.length || // TeXLive 2021 and earlier + 0 const failed = output?.stdout?.match(/^Latexmk: Errors/m) != null ? 1 : 0 // counters from latexmk output stats['latexmk-errors'] = failed diff --git a/services/clsi/buildscript.txt b/services/clsi/buildscript.txt index e4e31b2b85..f69c82e793 100644 --- a/services/clsi/buildscript.txt +++ b/services/clsi/buildscript.txt @@ -1,7 +1,7 @@ clsi --data-dirs=cache,compiles,output --dependencies= ---env-add=DOWNLOAD_HOST=http://clsi-nginx:8080,ALLOWED_COMPILE_GROUPS="clsi-perf simple-latex-file",ENABLE_PDF_CACHING="true",PDF_CACHING_ENABLE_WORKER_POOL="true",ALLOWED_IMAGES=quay.io/sharelatex/texlive-full:2025.1,TEXLIVE_IMAGE=quay.io/sharelatex/texlive-full:2025.1,TEX_LIVE_IMAGE_NAME_OVERRIDE=us-east1-docker.pkg.dev/overleaf-ops/ol-docker,TEXLIVE_IMAGE_USER="tex",SANDBOXED_COMPILES="true",SANDBOXED_COMPILES_HOST_DIR_COMPILES=$PWD/compiles,SANDBOXED_COMPILES_HOST_DIR_OUTPUT=$PWD/output +--env-add=DOWNLOAD_HOST=http://clsi-nginx:8080,ALLOWED_COMPILE_GROUPS="clsi-perf simple-latex-file",ENABLE_PDF_CACHING="true",PDF_CACHING_ENABLE_WORKER_POOL="true",ALLOWED_IMAGES="quay.io/sharelatex/texlive-full:2017.1 quay.io/sharelatex/texlive-full:2025.1",TEXLIVE_IMAGE=quay.io/sharelatex/texlive-full:2025.1,TEX_LIVE_IMAGE_NAME_OVERRIDE=us-east1-docker.pkg.dev/overleaf-ops/ol-docker,TEXLIVE_IMAGE_USER="tex",SANDBOXED_COMPILES="true",SANDBOXED_COMPILES_HOST_DIR_COMPILES=$PWD/compiles,SANDBOXED_COMPILES_HOST_DIR_OUTPUT=$PWD/output --env-pass-through= --esmock-loader=False --node-version=24.13.0 diff --git a/services/clsi/docker-compose.ci.yml b/services/clsi/docker-compose.ci.yml index 02ce8698b6..a1e188b4e5 100644 --- a/services/clsi/docker-compose.ci.yml +++ b/services/clsi/docker-compose.ci.yml @@ -31,7 +31,7 @@ services: ALLOWED_COMPILE_GROUPS: "clsi-perf simple-latex-file" ENABLE_PDF_CACHING: "true" PDF_CACHING_ENABLE_WORKER_POOL: "true" - ALLOWED_IMAGES: quay.io/sharelatex/texlive-full:2025.1 + ALLOWED_IMAGES: "quay.io/sharelatex/texlive-full:2017.1 quay.io/sharelatex/texlive-full:2025.1" TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2025.1 TEX_LIVE_IMAGE_NAME_OVERRIDE: us-east1-docker.pkg.dev/overleaf-ops/ol-docker TEXLIVE_IMAGE_USER: "tex" diff --git a/services/clsi/docker-compose.yml b/services/clsi/docker-compose.yml index 2812700d38..0ab691e535 100644 --- a/services/clsi/docker-compose.yml +++ b/services/clsi/docker-compose.yml @@ -45,7 +45,7 @@ services: ALLOWED_COMPILE_GROUPS: "clsi-perf simple-latex-file" ENABLE_PDF_CACHING: "true" PDF_CACHING_ENABLE_WORKER_POOL: "true" - ALLOWED_IMAGES: quay.io/sharelatex/texlive-full:2025.1 + ALLOWED_IMAGES: "quay.io/sharelatex/texlive-full:2017.1 quay.io/sharelatex/texlive-full:2025.1" TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2025.1 TEX_LIVE_IMAGE_NAME_OVERRIDE: us-east1-docker.pkg.dev/overleaf-ops/ol-docker TEXLIVE_IMAGE_USER: "tex" diff --git a/services/clsi/test/acceptance/js/SimpleLatexFileTests.js b/services/clsi/test/acceptance/js/SimpleLatexFileTests.js index 1a0632e132..3ee26adbab 100644 --- a/services/clsi/test/acceptance/js/SimpleLatexFileTests.js +++ b/services/clsi/test/acceptance/js/SimpleLatexFileTests.js @@ -3,6 +3,7 @@ import { fetchNothing, fetchString } from '@overleaf/fetch-utils' import ClsiApp from './helpers/ClsiApp.js' import { expect } from 'chai' import Settings from '@overleaf/settings' +import Metrics from '@overleaf/metrics' describe('Simple LaTeX file', function () { const content = `\ @@ -21,6 +22,18 @@ Hello world }, }, }, + { + description: 'simple file (TL2017)', + request: { + resources: [{ path: 'main.tex', content }], + options: { + compileGroup: 'simple-latex-file', + imageName: 'quay.io/sharelatex/texlive-full:2017.1', + }, + }, + // In TL2017 latexmk performs an extra LaTeX pass even for this simple document. + expectedRuns: 2, + }, { description: 'clsi-perf request', request: { @@ -49,6 +62,13 @@ Hello world } }) + after(function () { + // Clear all metrics after each scenario + if (Metrics.prom && Metrics.prom.register) { + Metrics.prom.register.resetMetrics() + } + }) + it('should return the PDF', function () { const pdf = Client.getOutputFile(this.body, 'pdf') pdf.type.should.equal('pdf') @@ -111,14 +131,15 @@ Hello world ] } + const expectedRuns = scenario.expectedRuns ?? 1 // Note: chai's all.keys assertion rejects extra keys stats.should.have.all.keys( 'isInitialCompile', 'latexmk-errors', 'latex-runs', 'latex-runs-with-errors', - 'latex-runs-1', - 'latex-runs-with-errors-1', + `latex-runs-${expectedRuns}`, + `latex-runs-with-errors-${expectedRuns}`, 'pdf-size', ...pdfCachingStats ) @@ -130,6 +151,11 @@ Hello world ...pdfCachingTimings ) }) + + it('should report the correct number of runs', function () { + const { stats } = this.body.compile + expect(stats['latex-runs']).to.equal(scenario.expectedRuns ?? 1) + }) }) }