summaryrefslogtreecommitdiff
path: root/lib/mesa/src/util/tests/string_buffer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/util/tests/string_buffer')
-rw-r--r--lib/mesa/src/util/tests/string_buffer/Makefile.am2
-rw-r--r--lib/mesa/src/util/tests/string_buffer/meson.build30
-rw-r--r--lib/mesa/src/util/tests/string_buffer/string_buffer_test.cpp6
3 files changed, 35 insertions, 3 deletions
diff --git a/lib/mesa/src/util/tests/string_buffer/Makefile.am b/lib/mesa/src/util/tests/string_buffer/Makefile.am
index bd04d8634..8bc8a9c9b 100644
--- a/lib/mesa/src/util/tests/string_buffer/Makefile.am
+++ b/lib/mesa/src/util/tests/string_buffer/Makefile.am
@@ -38,3 +38,5 @@ string_buffer_test_LDADD = \
$(top_builddir)/src/util/libmesautil.la \
$(PTHREAD_LIBS) \
$(DLOPEN_LIBS)
+
+EXTRA_DIST = meson.build
diff --git a/lib/mesa/src/util/tests/string_buffer/meson.build b/lib/mesa/src/util/tests/string_buffer/meson.build
new file mode 100644
index 000000000..9f42e3550
--- /dev/null
+++ b/lib/mesa/src/util/tests/string_buffer/meson.build
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+test(
+ 'string_buffer',
+ executable(
+ 'string_buffer_test',
+ 'string_buffer_test.cpp',
+ dependencies : [dep_thread, dep_dl, idep_gtest],
+ include_directories : inc_common,
+ link_with : [libmesa_util],
+ )
+)
diff --git a/lib/mesa/src/util/tests/string_buffer/string_buffer_test.cpp b/lib/mesa/src/util/tests/string_buffer/string_buffer_test.cpp
index 545f607fa..afb6dfb2a 100644
--- a/lib/mesa/src/util/tests/string_buffer/string_buffer_test.cpp
+++ b/lib/mesa/src/util/tests/string_buffer/string_buffer_test.cpp
@@ -95,15 +95,15 @@ TEST_F(string_buffer, string_buffer_tests)
EXPECT_TRUE(strlen(buf->buf) == 0);
/* Test a string with some formatting */
- sprintf(str4, "Testing formatting %d, %f", 100, 1.0);
+ snprintf(str4, sizeof(str4), "Testing formatting %d, %f", 100, 1.0);
EXPECT_TRUE(_mesa_string_buffer_printf(buf, "Testing formatting %d, %f", 100, 1.0));
EXPECT_TRUE(strcmp(buf->buf, str4) == 0);
/* Compile a string with some other formatting */
- sprintf(str5, "Testing formatting %d, %x", 100, 0xDEADBEAF);
+ snprintf(str5, sizeof(str5), "Testing formatting %d, %x", 100, 0xDEADBEAF);
/* Concatenate str5 to str4 */
- strcat(str4, str5);
+ strncat(str4, str5, sizeof(str5));
/* Now use the formatted append function again */
EXPECT_TRUE(_mesa_string_buffer_printf(buf, "Testing formatting %d, %x", 100, 0xDEADBEAF));