Files
swift-mirror/test/CAS/cas_fs.swift
Steven Wu e2c494179d [CAS] Integrate CAS into swift compiler
Teach swift compiler about CAS to allow compiler caching in the future.
1) Add flags to initiate CAS inside swift-frontend
2) Teach swift to compile using a CAS file system.
2023-04-17 13:18:09 -07:00

30 lines
1.6 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/empty
// RUN: mkdir -p %t/cas
// RUN: llvm-cas --cas %t/cas --ingest --data %t/empty > %t/empty.casid
// RUN: not %target-swift-frontend -typecheck -enable-cas -cas-fs @%t/empty.casid -cas-path %t/cas %s 2>&1 | %FileCheck %s --check-prefix NO-INPUTS
// NO-INPUTS: error: error opening input file
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/source.casid
// RUN: not %target-swift-frontend -typecheck -enable-cas -cas-fs @%t/source.casid -cas-path %t/cas %s 2>&1 | %FileCheck %s --check-prefix NO-RESOURCES
// NO-RESOURCES: error: unable to set working directory
// NO-RESOURCES: error: unable to load standard library
/// Ingest the resource directory to satisfy the file system requirement. Also switch CWD to resource dir.
// RUN: llvm-cas --cas %t/cas --merge @%t/source.casid %test-resource-dir > %t/full.casid
// RUN: cd %test-resource-dir
// RUN: %target-swift-frontend -typecheck -enable-cas -cas-fs @%t/full.casid -cas-path %t/cas %s
/// Try clang importer.
// RUN: not %target-swift-frontend -typecheck -enable-cas -cas-fs @%t/full.casid -cas-path %t/cas %s -import-objc-header %S/Inputs/objc.h 2>&1 | %FileCheck %s --check-prefix NO-BRIDGING-HEADER
// NO-BRIDGING-HEADER: error: bridging header
// RUN: llvm-cas --cas %t/cas --merge @%t/full.casid %S/Inputs/objc.h > %t/bridging_header.casid
// RUN: %target-swift-frontend -typecheck -enable-cas -cas-fs @%t/bridging_header.casid -cas-path %t/cas %s -import-objc-header %S/Inputs/objc.h
/// Clean the CAS to save space.
// RUN: %empty-directory(%t)
func testFunc() {}