Skip to content

Commit

Permalink
i#6112: Require a full output match in runmulti (#6113)
Browse files Browse the repository at this point in the history
Brackets the expected outpout with ^$ to require a complete match for
tests using runmulti.cmake. This matches what we do for single-command
tests for their PASS_REGULAR_EXPRESSION property.

Fixes #6112
  • Loading branch information
derekbruening authored Jun 5, 2023
1 parent b25c45f commit a4c601b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Total counts:
0 total physical address unavailable markers
*[0-9]* total other markers
*[0-9]* total encodings
.*
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Hello, world!
Basic counts tool results:
Total counts:
.* total \(fetched\) instructions
Expand Down Expand Up @@ -57,3 +58,4 @@ Interval #1 ending at timestamp.*
0 interval delta physical address unavailable markers
.* interval delta other markers
.* interval delta encodings.*
.*
1 change: 1 addition & 0 deletions clients/drcachesim/tests/offline-rseq.templatex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Hit delay threshold: enabling tracing.
All done
Cache simulation results:
Core #0 \(1 thread\(s\)\)
Expand Down
4 changes: 4 additions & 0 deletions clients/drcachesim/tests/raw2trace-simple.templatex
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
.*
\[drmemtrace\]: Reading module file from memory
open|close
.*
\[drmemtrace\]: Successfully read [0-9]+ modules
.*
\[drmemtrace\]: Successfully converted [0-9]+ thread files
Processed
About to load modules
Loaded modules successfully
Successfully found app entry
Custom user_free was called
.*
Read timestamp from thread header
Read timestamp without thread header
Verified boundary conditions
Expand Down
8 changes: 6 additions & 2 deletions suite/tests/runmulti.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# **********************************************************
# Copyright (c) 2015-2022 Google, Inc. All rights reserved.
# Copyright (c) 2015-2023 Google, Inc. All rights reserved.
# **********************************************************

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -53,6 +53,9 @@ macro(process_cmdline line skip_empty err_and_out)
string(REGEX REPLACE "@@" " " ${line} "${${line}}")
string(REGEX REPLACE "@" ";" ${line} "${${line}}")
string(REGEX REPLACE "!" "\\\;" ${line} "${${line}}")
# Clear to avoid repeating prior command if this one isn't run.
set(cmd_err "")
set(cmd_out "")

if (${line} MATCHES "^foreach;")
set(each ${${line}})
Expand Down Expand Up @@ -115,6 +118,7 @@ endmacro()
process_cmdline(precmd ON ignore)

process_cmdline(cmd OFF tomatch)
message("output: |${tomatch}|")

if (NOT "${postcmd}" STREQUAL "")
process_cmdline(postcmd OFF tomatch)
Expand All @@ -128,6 +132,6 @@ endif()
# get expected output (must already be processed w/ regex => literal, etc.)
file(READ "${cmp}" str)

if (NOT "${tomatch}" MATCHES "${str}")
if (NOT "${tomatch}" MATCHES "^${str}$")
message(FATAL_ERROR "output |${tomatch}| failed to match expected output |${str}|")
endif ()

0 comments on commit a4c601b

Please sign in to comment.