// Tests for successful clang-ssaf-linker linking behaviour. // See linking-errors.test for error cases. // RUN: rm -rf %t // RUN: mkdir -p %t // Single empty TU produces valid output. // RUN: clang-ssaf-linker %S/Inputs/tu-empty.json -o %t/lu-empty.json // RUN: diff %S/Outputs/lu-empty.json %t/lu-empty.json // RUN: rm %t/lu-empty.json // Single non-empty TU produces valid output. // RUN: clang-ssaf-linker %S/Inputs/tu-1.json -o %t/lu-1.json // RUN: diff %S/Outputs/lu-1.json %t/lu-1.json // RUN: rm %t/lu-1.json // Linking empty and non-empty TU is equivalent to just linking non-empty TU // RUN: clang-ssaf-linker %S/Inputs/tu-empty.json %S/Inputs/tu-1.json -o %t/lu-1.json // RUN: diff %S/Outputs/lu-1.json %t/lu-1.json // RUN: rm %t/lu-1.json // Linking non-empty and empty TU is equivalent to just linking non-empty TU // RUN: clang-ssaf-linker %S/Inputs/tu-2.json %S/Inputs/tu-empty.json -o %t/lu-2.json // RUN: diff %S/Outputs/lu-2.json %t/lu-2.json // RUN: rm %t/lu-2.json // Linking two TUs correctly resolves and patches data. // RUN: clang-ssaf-linker %S/Inputs/tu-1.json %S/Inputs/tu-2.json -o %t/lu-1+2.json // RUN: diff %S/Outputs/lu-1+2.json %t/lu-1+2.json // RUN: rm %t/lu-1+2.json // Relative input path: cd to the test source directory so that // Inputs/tu-1.json is a valid relative path. // RUN: cd %S && clang-ssaf-linker Inputs/tu-1.json -o %t/lu-1.json // RUN: diff %S/Outputs/lu-1.json %t/lu-1.json // RUN: rm %t/lu-1.json // Relative output path: cd to the temp directory so that lu-1.json // (no directory component) resolves relative to the current directory. // RUN: cd %t && clang-ssaf-linker %S/Inputs/tu-1.json -o lu-1.json // RUN: diff %S/Outputs/lu-1.json %t/lu-1.json // RUN: rm %t/lu-1.json