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

The check github.com/gohugoio/hugo/tpl/tplimpl fails on s390x/Fedora Rawhide #13204

Open
flyn-org opened this issue Dec 30, 2024 · 1 comment

Comments

@flyn-org
Copy link

flyn-org commented Dec 30, 2024

What version of Hugo are you using (hugo version)?

$ hugo version
0.140.1

Does this issue reproduce with the latest release?

Yes.

The check github.com/gohugoio/hugo/tpl/tplimpl fails on s390x/Fedora Rawhide. I suspect this might be due to floating-point precision. If you search for "1.557407724654" in the following output, you will find it as part of two floating-point outputs. The subsequent digits differ, though.

github.com/gohugoio/hugo/tpl/tplimpl
Template changed /_default/baseof.html
--- FAIL: TestTemplateFuncsExamples (0.03s)
    template_funcs_test.go:85: 
        error:
          no substring match found
        comment:
          File: public/blog/hugo-rocks/index.html Match 1.557407724654902
          Content:
          int
          string
          float64
          2+2 is 4
          Hugo Rocks!
          Hugo Rules!
          current-section
          Reasonable new Hugo version!
          4
          A, B and C
          Substring found!
          [A B C]
          [1 2 3 4 5]
          [Yes, Hugo Rocks! Hugo Rocks!]
          [Yes, Hugo Rocks! Hugo Rocks!]
          [Yes, Hugo Rocks! For reals! Hugo Rocks!]
          [1 2 4]
          key: [a b]
          [a f]
          [1 2 3]
          bar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose
          <a href="https://www.google.com?page=3&amp;q=test">Search</a>
          bar=2&foo=1
          [1 2 3]
          b3029f756f98f79e7f1b7f1d1f0dd53b
          b3029f756f98f79e7f1b7f1d1f0dd53b
          c8b5b0e33d408246e30f53e32b8f7627a7a649d4
          6ec43b78da9669f50e4e422575c54bf87536954ccd58280219c393f2ce352b46
          b6d11b6c53830b9d87036272ca9fe9d19306b8f9d8aa07b15da27d89e6e34f40
          
          
          {
            "Hugo": "Rocks!"
          }
          Hello world
          42
          SGVsbG8gd29ybGQ=
          ["A","B","C"]
          [
            "A",
            "B",
            "C"
          ]
          
          works!
          works!
          
          works!
          
          
          1515779328
          0b242d361fda71bc
          My first post
          My camel post
          52nd
          103rd
          cats
          cat
          512.50
          512.50%
          $512.50
          NOK512.50
          12,345.68
          12.345,68
          -12345.678900
          -12,346
          -12 346
          -98,765.43
          6
          2
          1.5574077246549018
          1.5707963267948966
          3
          2
          1
          true
          90
          8
          9
          1
          0
          0.4636476090008061
          0
          2
          0
          2.1
          3.141592653589793
          1.5707963267948966
          0.8414709848078965
          3
          0.7853981633974484
          0.5403023058681398
          1
          README.txt
          Hugo Rocks!
          false
          <title>Hugo Rocks!</title>
          /my/path/|filename.txt
          /my/path/|filename.txt
          my/path/filename.txt
          my/path/filename.txt
          .txt
          filename.txt
          my/path
          Map
          Slice
          http://gohugo.io
          Bat&amp;Man
          Bat&Man
          Bat&Man
          (1*2)
          3
          this is a ...
          With <a href="/markdown">Markdown …</a>
          aabba
          aabb
          yoyoyoyo
          BATMAN
          true
          false
          Batman
          <p>Blockhead</p>
          true
          false
          Bat
          Man
          bbaa
          Hugo rocks!
          true
          false
          [go]
          [[<a href="#foo">Foo</a> #foo Foo] [<a href="#bar">Bar</a> #bar Bar]]
          Batman and Catwoman
          zzbbaabb
          abbaa
          bbaa
          true
          false
          XbXbX
          Xbaabbab
          batman
          Bat Man
          Somewhere Over the Rainbow
          Bat
          Man
          aabb
          Yes!
          No!
          1h0m0s
          1h12m10s
          dateFormat: Wednesday, Jan 21, 2015
          2015
          I �� Hugo
          Cathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;
          Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;[email protected]&amp;gt;
          Cathal Garvey & The Sunshine Band <[email protected]>
          Hello world, gophers!
          Cathal Garvey & The Sunshine Band <[email protected]>
          Cathal Garvey & The Sunshine Band <[email protected]>
          Cathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;
          Cathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;
          <strong>BatMan</strong>
          {
             "title": "Hello World"
          }
          
          map[hello:Hello World]
          map[hello:Hello World]
          this-is-a-title
          https://example.org/foo
          a/b
        container:
          "int\nstring\nfloat64\n2+2 is 4\nHugo Rocks!\nHugo Rules!\ncurrent-section\nReasonable new Hugo version!\n4\nA, B and C\nSubstring found!\n[A B C]\n[1 2 3 4 5]\n[Yes, Hugo Rocks! Hugo Rocks!]\n[Yes, Hugo Rocks! Hugo Rocks!]\n[Yes, Hugo Rocks! For reals! Hugo Rocks!]\n[1 2 4]\nkey: [a b]\n[a f]\n[1 2 3]\nbar=2&baz=with+spaces&foo=1&qux=this%26that%3Dthose\n<a href=\"https://www.google.com?page=3&amp;q=test\">Search</a>\nbar=2&foo=1\n[1 2 3]\nb3029f756f98f79e7f1b7f1d1f0dd53b\nb3029f756f98f79e7f1b7f1d1f0dd53b\nc8b5b0e33d408246e30f53e32b8f7627a7a649d4\n6ec43b78da9669f50e4e422575c54bf87536954ccd58280219c393f2ce352b46\nb6d11b6c53830b9d87036272ca9fe9d19306b8f9d8aa07b15da27d89e6e34f40\n\n\n{\n  \"Hugo\": \"Rocks!\"\n}\nHello world\n42\nSGVsbG8gd29ybGQ=\n[\"A\",\"B\",\"C\"]\n[\n  \"A\",\n  \"B\",\n  \"C\"\n]\n\nworks!\nworks!\n\nworks!\n\n\n1515779328\n0b242d361fda71bc\nMy first post\nMy camel post\n52nd\n103rd\ncats\ncat\n512.50\n512.50%\n$512.50\nNOK512.50\n12,345.68\n12.345,68\n-12345.678900\n-12,346\n-12 346\n-98,765.43\n6\n2\n1.5574077246549018\n1.5707963267948966\n3\n2\n1\ntrue\n90\n8\n9\n1\n0\n0.4636476090008061\n0\n2\n0\n2.1\n3.141592653589793\n1.5707963267948966\n0.8414709848078965\n3\n0.7853981633974484\n0.5403023058681398\n1\nREADME.txt\nHugo Rocks!\nfalse\n<title>Hugo Rocks!</title>\n/my/path/|filename.txt\n/my/path/|filename.txt\nmy/path/filename.txt\nmy/path/filename.txt\n.txt\nfilename.txt\nmy/path\nMap\nSlice\nhttp://gohugo.io\nBat&amp;Man\nBat&Man\nBat&Man\n(1*2)\n3\nthis is a ...\nWith <a href=\"/markdown\">Markdown …</a>\naabba\naabb\nyoyoyoyo\nBATMAN\ntrue\nfalse\nBatman\n<p>Blockhead</p>\ntrue\nfalse\nBat\nMan\nbbaa\nHugo rocks!\ntrue\nfalse\n[go]\n[[<a href=\"#foo\">Foo</a> #foo Foo] [<a href=\"#bar\">Bar</a> #bar Bar]]\nBatman and Catwoman\nzzbbaabb\nabbaa\nbbaa\ntrue\nfalse\nXbXbX\nXbaabbab\nbatman\nBat Man\nSomewhere Over the Rainbow\nBat\nMan\naabb\nYes!\nNo!\n1h0m0s\n1h12m10s\ndateFormat: Wednesday, Jan 21, 2015\n2015\nI â�¤ï¸� Hugo\nCathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;\nCathal Garvey &amp;amp; The Sunshine Band &amp;lt;[email protected]&amp;gt;\nCathal Garvey & The Sunshine Band <[email protected]>\nHello world, gophers!\nCathal Garvey & The Sunshine Band <[email protected]>\nCathal Garvey & The Sunshine Band <[email protected]>\nCathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;\nCathal Garvey &amp; The Sunshine Band &lt;[email protected]&gt;\n<strong>BatMan</strong>\n{\n   \"title\": \"Hello World\"\n}\n\nmap[hello:Hello World]\nmap[hello:Hello World]\nthis-is-a-title\nhttps://example.org/foo\na/b"
        want:
          "1.557407724654902"
        stack:
          /builddir/build/BUILD/hugo-0.140.1-build/hugo-0.140.1/_build/src/github.com/gohugoio/hugo/hugolib/integrationtest_builder.go:317
            s.Assert(content, qt.Contains, match, cm)
          /builddir/build/BUILD/hugo-0.140.1-build/hugo-0.140.1/_build/src/github.com/gohugoio/hugo/tpl/tplimpl/template_funcs_test.go:85
            b.AssertFileContent("public/blog/hugo-rocks/index.html", expected...)
        
FAIL
exit status 1
FAIL	github.com/gohugoio/hugo/tpl/tplimpl	0.257s
@jmooring
Copy link
Member

jmooring commented Dec 30, 2024

For math functions that return a float64, maybe we should reduce the precision of the returned value from 16 significant digits to 12 significant digits. Our unit tests for these functions only test for 4 significant digits.

Or, since we already have good unit test coverage on the math functions, skip the tests as defined in tpl/math/init.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants