// Tests for EntityLinker error conditions. // RUN: rm -rf %t // RUN: mkdir -p %t // Linking the same TU namespace twice produces an error. // RUN: not clang-ssaf-linker %S/Inputs/tu-empty.json %S/Inputs/tu-empty.json -o %t/lu.json 2>&1 \ // RUN: | FileCheck %s --match-full-lines --check-prefix=DUP-NS // DUP-NS: clang-ssaf-linker: error: Linking summary '{{.*}}tu-empty.json' // DUP-NS-NEXT: failed to link TU summary: duplicate BuildNamespace(CompilationUnit, empty.cpp) // Entity ID object in summary data blob with '@' key alongside extra keys is a fatal error. // RUN: not clang-ssaf-linker %S/Inputs/tu-invalid-entity-id-multikey.json -o %t/lu.json 2>&1 \ // RUN: | FileCheck %s --match-full-lines --check-prefix=INVALID-ID-MULTIKEY // INVALID-ID-MULTIKEY: clang-ssaf-linker: error: Linking summary '{{.*}}tu-invalid-entity-id-multikey.json' // INVALID-ID-MULTIKEY-NEXT: failed to read EntityId: expected JSON object with a single '@' key mapped to a number (unsigned 64-bit integer) // Entity ID object in summary data blob with a non-uint64 '@' value is a fatal error. // RUN: not clang-ssaf-linker %S/Inputs/tu-invalid-entity-id-value.json -o %t/lu.json 2>&1 \ // RUN: | FileCheck %s --match-full-lines --check-prefix=INVALID-ID-VALUE // INVALID-ID-VALUE: clang-ssaf-linker: error: Linking summary '{{.*}}tu-invalid-entity-id-value.json' // INVALID-ID-VALUE-NEXT: failed to read EntityId: expected JSON object with a single '@' key mapped to a number (unsigned 64-bit integer) // Entity ID reference in summary data blob pointing to an ID absent from the resolution table // RUN: not clang-ssaf-linker %S/Inputs/tu-invalid-entity-id-ref.json -o %t/lu.json 2>&1 \ // RUN: | FileCheck %s --match-full-lines --check-prefix=INVALID-ID-REF // INVALID-ID-REF: clang-ssaf-linker: error: Linking summary '{{.*}}tu-invalid-entity-id-ref.json' // INVALID-ID-REF-NEXT: failed to patch EntityId: 'EntityId(99)' not found in entity resolution table