]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gprofng/testsuite/gprofng.display/gp-archive.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gprofng / testsuite / gprofng.display / gp-archive.exp
1 # Copyright (C) 2021-2024 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 # This script tests the -a option for "profng archive".
22
23 global srcdir CC CLOCK_GETTIME_LINK
24 set gprofng $::env(GPROFNG)
25 set tdir "tmpdir/gp-archive"
26
27 proc check_gp_archive { a_opt } {
28 global tdir gprofng
29 set cmd "$gprofng archive -a $a_opt $tdir/exp.er"
30 set output [run_native_host_cmd "$cmd"]
31 if { [lindex $output 0] != 0 } then {
32 set out [lindex $output 1]
33 send_log "'$cmd' failed\n"
34 fail $tdir
35 return -code break
36 }
37
38 run_native_host_cmd "mv $tdir/t.c $tdir/t.c.1"
39 set output [run_native_host_cmd "$gprofng display text -source main $tdir/exp.er"]
40 set out [lindex $output 1]
41 if { [string first "CORRECTSOURCE" [lindex $output 1]] < 0 } then {
42 set out [lindex $output 1]
43 send_log "CORRECTSOURCE is not found aafter '$cmd'\n"
44 fail $tdir
45 return -code break
46 }
47 }
48
49 run_native_host_cmd "mkdir -p $tdir"
50
51 # Build test, create experiment:
52 set output [run_native_host_cmd "cd $tdir && \
53 cat $srcdir/lib/smalltest.c | sed '1 i /* CORRECTSOURCE */' > t.c && \
54 $CC -g t.c $CLOCK_GETTIME_LINK && \
55 $gprofng collect app -p on -a off -O exp.er ./a.out"]
56
57 if { [lindex $output 0] != 0 } then {
58 set out [lindex $output 1]
59 send_log "Experiment is not created in $tdir\n"
60 fail $tdir
61 return
62 }
63
64
65 check_gp_archive src
66
67 run_native_host_cmd "rm -rf $tdir/exp.er/archives/*; mv $tdir/t.c.1 $tdir/t.c"
68 check_gp_archive usedsrc
69
70 pass $tdir