(t *testing.T)
| 902 | } |
| 903 | |
| 904 | func TestTest(t *testing.T) { |
| 905 | t.Parallel() |
| 906 | |
| 907 | type targ struct { |
| 908 | name string |
| 909 | opts compileopts.Options |
| 910 | } |
| 911 | targs := []targ{ |
| 912 | // Host |
| 913 | {"Host", optionsFromTarget("", sema)}, |
| 914 | } |
| 915 | if !testing.Short() { |
| 916 | if runtime.GOOS == "linux" { |
| 917 | for name, osArch := range supportedLinuxArches { |
| 918 | options := optionsFromOSARCH(osArch, sema) |
| 919 | if options.GOARCH != runtime.GOARCH { // Native architecture already run above. |
| 920 | targs = append(targs, targ{name, options}) |
| 921 | } |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | targs = append(targs, |
| 926 | // QEMU microcontrollers |
| 927 | targ{"EmulatedCortexM3", optionsFromTarget("cortex-m-qemu", sema)}, |
| 928 | targ{"EmulatedRISCV", optionsFromTarget("riscv-qemu", sema)}, |
| 929 | |
| 930 | // Node/Wasmtime |
| 931 | targ{"WASM", optionsFromTarget("wasm", sema)}, |
| 932 | targ{"WASI", optionsFromTarget("wasip1", sema)}, |
| 933 | ) |
| 934 | } |
| 935 | for _, targ := range targs { |
| 936 | targ := targ |
| 937 | t.Run(targ.name, func(t *testing.T) { |
| 938 | t.Parallel() |
| 939 | |
| 940 | emuCheck(t, targ.opts) |
| 941 | |
| 942 | t.Run("Pass", func(t *testing.T) { |
| 943 | t.Parallel() |
| 944 | |
| 945 | // Test a package which builds and passes normally. |
| 946 | |
| 947 | var wg sync.WaitGroup |
| 948 | defer wg.Wait() |
| 949 | |
| 950 | out := ioLogger(t, &wg) |
| 951 | defer out.Close() |
| 952 | |
| 953 | opts := targ.opts |
| 954 | passed, err := Test("github.com/tinygo-org/tinygo/tests/testing/pass", out, out, &opts, "") |
| 955 | if err != nil { |
| 956 | t.Errorf("test error: %v", err) |
| 957 | } |
| 958 | if !passed { |
| 959 | t.Error("test failed") |
| 960 | } |
| 961 | }) |
nothing calls this directly
no test coverage detected