1Test the input file names overlap with the output file names.
2
3This is OK for merging instrument profiles.
4RUN: cp %S/Inputs/same-name-1.proftext %t.0.proftext
5RUN: llvm-profdata merge -o %t.0.profdata -text %t.0.proftext %t.0.proftext
6RUN: llvm-profdata show -counts -all-functions %t.0.profdata -o %t_show_0
7RUN: llvm-profdata show -counts -all-functions %S/Inputs/same-name-2.proftext -o %t_show_1
8RUN: diff %t_show_0 %t_show_1
9RUN: llvm-profdata merge -o %t.1.profdata %S/Inputs/same-name-1.proftext
10RUN: llvm-profdata merge -o %t.1.profdata %t.1.profdata %t.1.profdata
11RUN: llvm-profdata show -counts -all-functions %t.1.profdata -o %t_show_2
12RUN: diff %t_show_2 %t_show_1
13
14We report error for the show command.
15RUN: not llvm-profdata show -o %t.1.profdata %t.1.profdata 2>&1 | FileCheck %s
16CHECK: llvm-profdata{{.*}} show: Input file name cannot be the same as the output file name!
17
18This is OK for merging sample fdo profiles.
19RUN: cp %S/Inputs/same-name-3.proftext %t.3.proftext
20RUN: llvm-profdata merge --sample -o %t.3.profdata -text %t.3.proftext %t.3.proftext
21RUN: llvm-profdata show --sample -counts -all-functions %t.3.profdata -o %t_show_3
22RUN: llvm-profdata show --sample -counts -all-functions %S/Inputs/same-name-4.proftext -o %t_show_4
23RUN: diff %t_show_3 %t_show_4
24RUN: llvm-profdata merge --sample -o %t.5.profdata %S/Inputs/same-name-3.proftext
25RUN: llvm-profdata merge --sample -o %t.5.profdata %t.5.profdata %t.5.profdata
26RUN: llvm-profdata show --sample -counts -all-functions %t.5.profdata -o %t_show_6
27RUN: diff %t_show_6 %t_show_4
28