2022-01-10 13:05:20 +08:00
|
|
|
// Licensed to the LF AI & Data foundation under one
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
// distributed with this work for additional information
|
|
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
2021-11-29 14:29:24 +08:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2022-01-10 13:05:20 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-11-29 14:29:24 +08:00
|
|
|
//
|
2022-01-10 13:05:20 +08:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-11-29 14:29:24 +08:00
|
|
|
|
2023-01-12 16:09:39 +08:00
|
|
|
package tracer
|
2021-11-29 14:29:24 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2023-03-14 17:36:05 +08:00
|
|
|
func testStackTrace(t *testing.T) {
|
|
|
|
t.Log(StackTraceMsg(1))
|
|
|
|
t.Log(StackTraceMsg(5))
|
|
|
|
t.Log(StackTraceMsg(10))
|
2021-12-28 20:44:46 +08:00
|
|
|
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTrace())
|
2021-12-28 20:44:46 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 14:29:24 +08:00
|
|
|
func TestStackTraceMsg(t *testing.T) {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTraceMsg(1))
|
|
|
|
t.Log(StackTraceMsg(5))
|
|
|
|
t.Log(StackTraceMsg(10))
|
2021-11-29 14:29:24 +08:00
|
|
|
|
|
|
|
func() {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTraceMsg(10))
|
2021-11-29 14:29:24 +08:00
|
|
|
}()
|
|
|
|
|
|
|
|
func() {
|
|
|
|
func() {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTraceMsg(10))
|
2021-11-29 14:29:24 +08:00
|
|
|
}()
|
|
|
|
}()
|
2021-12-28 20:44:46 +08:00
|
|
|
|
2023-03-14 17:36:05 +08:00
|
|
|
testStackTrace(t)
|
2021-11-29 14:29:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestStackTrace(t *testing.T) {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTrace())
|
2021-11-29 14:29:24 +08:00
|
|
|
|
|
|
|
func() {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTrace())
|
2021-11-29 14:29:24 +08:00
|
|
|
}()
|
|
|
|
|
|
|
|
func() {
|
|
|
|
func() {
|
2023-03-14 17:36:05 +08:00
|
|
|
t.Log(StackTrace())
|
2021-11-29 14:29:24 +08:00
|
|
|
}()
|
|
|
|
}()
|
|
|
|
}
|