Closed Bug 1690572 Opened 3 years ago Closed 3 years ago

TestLogging.cpp:92:3: error: ?SprintfLiteral? was not declared in this scope

Categories

(Firefox :: Untriaged, defect)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox85 --- unaffected
firefox86 --- unaffected
firefox87 --- fixed

People

(Reporter: petr.sumbera, Assigned: nalexander)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

Build on Solaris failed with following error:

16:06.36 In file included from Unified_cpp_xpcom_tests_gtest1.cpp:74:
16:06.36 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In function ?void WriteTestLogFile(const char*, uint32_t)?:
16:06.36 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:32:5: error: ?SprintfLiteral? was not declared in this scope
16:06.36    32 |     SprintfLiteral(buf, WHOLE_LINE, i);
16:06.36       |     ^~~~~~~~~~~~~~
16:06.38 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_DoesNothingWhenNotNeededExact_Test::TestBody()?: 16:06.38 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:70:3: error: ?SprintfLiteral? was not declared in this scope
16:06.38    70 |   SprintfLiteral(
16:06.38       |   ^~~~~~~~~~~~~~
16:06.39 Undefined                      first referenced
16:06.39  symbol                            in file
16:06.39 av_hwframe_ctx_alloc                libmozavcodec.so.symbols
16:06.39 ld: warning: symbol referencing errors
16:06.40 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_DoesNothingWhenNotNeededInexact_Test::TestBody()?:
16:06.40 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:92:3: error: ?SprintfLiteral? was not declared in this scope
16:06.40    92 |   SprintfLiteral(
16:06.40       |   ^~~~~~~~~~~~~~
16:06.41 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_LimitsToLessThanSize_Test::TestBody()?:
16:06.41 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:115:3: error: ?SprintfLiteral? was not declared in this scope
16:06.41   115 |   SprintfLiteral(
16:06.41       |   ^~~~~~~~~~~~~~
16:06.43 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_MayCutLongLinesExact_Test::TestBody()?:
16:06.43 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:136:3: error: ?SprintfLiteral? was not declared in this scope
16:06.43   136 |   SprintfLiteral(
16:06.43       |   ^~~~~~~~~~~~~~
16:06.44 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp: In member function ?virtual void Logging_MayCutLongLinesInexact_Test::TestBody()?:
16:06.44 /builds/psumbera/mozilla-central-build/xpcom/tests/gtest/TestLogging.cpp:161:3: error: ?SprintfLiteral? was not declared in this scope
16:06.44   161 |   SprintfLiteral(
16:06.44       |   ^~~~~~~~~~~~~~

The first bad revision is:
changeset: 565810:da3640fcab7b
user: Nick Alexander <nalexander@mozilla.com>
date: Tue Feb 02 20:35:01 2021 -0800
description:
Bug 1687549 - Allow to limit MOZ_LOG file with maxsize:N when using append. r=xpcom-reviewers,kmag

The existing `append` option allows to accumulate logs. The `rotate:N`
option added in Bug 1244306 allows to limit the growth of the log, but
it's both incompatible with `append` and not well suited for a single
cumulative historical log across multiple runs, since it's unclear how
to manage the current log file index across invocations.  Continuously
limiting the file size for each log message is technically
challenging.

This commit pursues a much simpler approach.  When `maxsize:N` is
specified with `append`, before a log file is opened, it "tails" the
file to be at most N // 2 bytes long.  It tries to keep lines intact
at low runtime memory cost, but allows very long lines may be cut.

This implementation wants an atomic file rename operation, which is
supported on Win32 and POSIX OSes only at this time.  On other OSes, a
compile time error will be raised.

Differential Revision: https://phabricator.services.mozilla.com/D103405

Any idea about the failure?

Flags: needinfo?(nalexander)
Regressed by: 1687549
Has Regression Range: --- → yes

(In reply to Petr Sumbera from comment #1)

Any idea about the failure?

Not really. TestLogging.cpp does not appear to be the only consumer of SprintfLiteral in gtest: https://searchfox.org/mozilla-central/search?q=sprintfliteral&path=gtest&case=false&regexp=false. Can you try ensuring that TestLogging.cpp has

#include "mozilla/Sprintf.h"

Perhaps the error is literally true: it was not declared in this scope. But it's odd to see that only at link-time. In any case, let me know.

Flags: needinfo?(nalexander)

NI to investigate one more step.

Flags: needinfo?(petr.sumbera)

I can confirm that following fixed the issue:

--- a/xpcom/tests/gtest/TestLogging.cpp Wed Feb 03 10:37:44 2021 +0100
+++ b/xpcom/tests/gtest/TestLogging.cpp Wed Feb 03 23:24:12 2021 +0100
@@ -5,6 +5,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

 #include "mozilla/Logging.h"
+#include "mozilla/Sprintf.h"
 #include "gtest/gtest.h"

 namespace mozilla::detail {

For record my mozconfig file is:

ac_add_options --with-system-icu
ac_add_options --with-system-libevent
ac_add_options --with-system-zlib
ac_add_options --enable-js-shell
ac_add_options --prefix=/opt/firefox
ac_add_options --enable-jemalloc
ac_add_options --enable-replace-malloc
ac_add_options --enable-pulseaudio
ac_add_options --enable-debug
ac_add_options --disable-install-strip
# use gcc (not clang)
ac_add_options --enable-release
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-optimize
ac_add_options --disable-geckodriver
# https://bugzilla.mozilla.org/show_bug.cgi?id=1547217
ac_add_options --disable-verify-mar
# no nasm on intel yet
ac_add_options --disable-av1
Flags: needinfo?(petr.sumbera)

Set release status flags based on info from the regressing bug 1687549

Assignee: nobody → nalexander
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0a7c759fd9ce
Avoid `error: ?SprintfLiteral? was not declared in this scope` on Solaris. r=xpcom-reviewers,sg
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: