File: output_determinism_check.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (42 lines) | stat: -rw-r--r-- 4,426 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// RUN: %empty-directory(%t)
// RUN: echo '[]' > %t/protocol.json
// RUN: %target-swift-frontend -module-name test -emit-module -o %t/test.swiftmodule %s -emit-module-doc-path %t/test.docc -const-gather-protocols-file %t/protocol.json -emit-const-values-path %t/test.swiftconstvalues -emit-tbd-path %t/test.tbd -tbd-current-version 1 -tbd-compatibility-version 1 -tbd-install_name @rpath/test.dylib -emit-loaded-module-trace -emit-loaded-module-trace-path %t/test.trace.json -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=MODULE_OUTPUT --check-prefix=DOCC_OUTPUT --check-prefix=CONSTVALUE_OUTPUT --check-prefix=TBD_OUTPUT --check-prefix=TRACE_OUTPUT
// RUN: %target-swift-frontend -module-name test -emit-sib -o %t/test.sib -primary-file %s -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=SIB_OUTPUT

/// object files are "not" deterministic because the second run going to match the mod hash and skip code generation.
// RUN: not %target-swift-frontend -module-name test -c -o %t/test.o -primary-file %s -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=OBJECT_MISMATCH
/// object files should match when forcing object generation.
// RUN: %target-swift-frontend -module-name test -emit-dependencies -c -o %t/test.o -primary-file %s -enable-deterministic-check -always-compile-output-files 2>&1 | %FileCheck %s --check-prefix=OBJECT_OUTPUT --check-prefix=DEPS_OUTPUT

/// FIXME: Fine-grain dependencies graph is not deterministics.
/// FAIL:  %target-swift-frontend -module-name test -emit-reference-dependencies-path %t/test.swiftdeps -c -o %t/test.o -primary-file %s -enable-deterministic-check -always-compile-output-files

/// Explicit module build. Check building swiftmodule from interface file.
// RUN: %target-swift-frontend -scan-dependencies -module-name test -o %t/test.json %s -enable-deterministic-check  -load-dependency-scan-cache -dependency-scan-cache-path %t/deps-cache -serialize-dependency-scan-cache 2>&1 | %FileCheck %s --check-prefix=DEPSCAN_OUTPUT --check-prefix=DEPSCAN_CACHE_OUTPUT
/// TODO: Implicit module build use a different compiler instance so it doesn't support checking yet.
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/test.swiftinterface %s -O -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=INTERFACE_OUTPUT
/// Hit cache and not emit the second time.
// RUN: rm %t/test.swiftmodule
// RUN: not %target-swift-frontend -compile-module-from-interface %t/test.swiftinterface -explicit-interface-module-build -o %t/test.swiftmodule -enable-deterministic-check 2>&1 | %FileCheck --check-prefix=MODULE_MISMATCH %s
/// Force swiftmodule generation.
// RUN: %target-swift-frontend -compile-module-from-interface %t/test.swiftinterface -explicit-interface-module-build -o %t/test.swiftmodule -enable-deterministic-check -always-compile-output-files 2>&1 | %FileCheck --check-prefix=MODULE_OUTPUT %s

// RUN: %target-swift-frontend -emit-pcm -module-name UserClangModule -o %t/test.pcm %S/Inputs/dependencies/module.modulemap -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=PCM_OUTPUT

// DOCC_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.docc'
// CONSTVALUE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.swiftconstvalues'
// MODULE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.swiftmodule'
// TBD_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.tbd'
// TRACE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.trace.json'
// SIB_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.sib'
// DEPS_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.d'
// OBJECT_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.o'
// OBJECT_MISMATCH: error: output file '{{.*}}{{/|\\}}test.o' is missing from second compilation for deterministic check
// DEPSCAN_CACHE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}deps-cache'
// DEPSCAN_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.json'
// INTERFACE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.swiftinterface'
// MODULE_MISMATCH: error: output file '{{.*}}{{/|\\}}test.swiftmodule' is missing from second compilation for deterministic check
// PCM_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.pcm'

public var x = 1
public func test() {}