gprofng: Add new tests
[binutils-gdb.git] / gprofng / testsuite / gprofng.display / gp-collect-app_F.exp
1 # Copyright (C) 2021-2023 Free Software Foundation, Inc.
2 #
3 # This file is part of the GNU Binutils.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18 # MA 02110-1301, USA.
19
20
21 # gp-collect-app should follow descendants, which names match specified regular expressions
22 #
23 # This script tests the following cases:
24 # 1. collect -F off
25 # 2. collect -F on
26 # 3. collect -F =<REGULAR EXPRESSION>
27
28 set gprofng $::env(GPROFNG)
29 set tdir "tmpdir/gp-collect-app_F"
30
31 proc run_gp_collect_app { subExpCnt F_opt } {
32 global tdir gprofng
33 set output [run_native_host_cmd "cd $tdir && \
34 $gprofng collect app -p on -a off -F '$F_opt' -O exp.er \
35 sh -c 'mkdir t && touch t/x; rm -rf t' "]
36 if { [lindex $output 0] != 0 } then {
37 set out [lindex $output 1]
38 send_log "Experiment is not created in $tdir\n"
39 fail $tdir
40 exit 1
41 }
42
43 set output [run_native_host_cmd "find $tdir -name '*x1.er' | wc -l"]
44 set subExp [lindex $output 1]
45 if { $subExp != $subExpCnt } then {
46 set out [lindex $output 1]
47 send_log "Test failed for -F $F_opt. subExp=$subExp. Shold be $subExpCnt\n"
48 fail $tdir
49 exit 1
50 }
51 return $output
52 }
53
54 run_native_host_cmd "mkdir -p $tdir"
55
56 run_gp_collect_app 0 "off"
57 run_gp_collect_app 3 "on"
58 run_gp_collect_app 1 "=mkd.r"
59 run_gp_collect_app 2 "=mkdir|touch"
60
61 pass $dir
62