This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/main by this push:
     new d0ac2fa  Support profiling E2E (#8)
d0ac2fa is described below

commit d0ac2fa7d4b611d46eddde6c5159bfb224d91fd5
Author: mrproliu <[email protected]>
AuthorDate: Sun Mar 27 15:50:54 2022 +0800

    Support profiling E2E (#8)
---
 .asf.yaml                                          |   2 +-
 .github/workflows/build-and-test.yaml              |  70 ------------
 .github/workflows/rover.yaml                       | 124 +++++++++++++++++++++
 Makefile                                           |   1 +
 docker/Dockerfile.build                            |  40 +++++++
 pkg/profiling/task/oncpu/runner.go                 |  10 +-
 scripts/build/docker.mk                            |  28 +++++
 test/e2e/base/base-compose.yml                     |  57 ++++++++++
 Makefile => test/e2e/base/env                      |  15 +--
 .../prepare/setup-e2e-shell/install-swctl.sh       |  30 +++++
 .../scripts/prepare/setup-e2e-shell/install-yq.sh  |  30 +++++
 .../scripts/prepare/setup-e2e-shell/install.sh     |  35 ++++++
 test/e2e/cases/profiling/c++/Dockerfile.sqrt       |  23 ++++
 .../e2e/cases/profiling/c++/docker-compose.yml     |  37 ++++--
 test/e2e/cases/profiling/c++/e2e.yaml              |  46 ++++++++
 .../e2e/cases/profiling/c++/profiling-analysis.yml |  26 ++---
 test/e2e/cases/profiling/c++/sqrt.cpp              |  31 ++++++
 test/e2e/cases/profiling/c/Dockerfile.sqrt         |  23 ++++
 .../e2e/cases/profiling/c/docker-compose.yml       |  37 ++++--
 test/e2e/cases/profiling/c/e2e.yaml                |  46 ++++++++
 .../e2e/cases/profiling/c/profiling-analysis.yml   |  26 ++---
 test/e2e/cases/profiling/c/sqrt.c                  |  29 +++++
 .../e2e/cases/profiling/expected/instance.yml      |  22 ++--
 .../e2e/cases/profiling/expected/process.yml       |  34 +++---
 .../cases/profiling/expected/profiling-create.yml  |  17 +--
 .../profiling/expected/profiling-schedule-list.yml |  52 +++++----
 .../profiling/expected/profiling-task-list.yml     |  29 ++---
 .../e2e/cases/profiling/expected/service.yml       |  23 ++--
 test/e2e/cases/profiling/golang/Dockerfile.sqrt    |  23 ++++
 .../e2e/cases/profiling/golang/docker-compose.yml  |  37 ++++--
 test/e2e/cases/profiling/golang/e2e.yaml           |  46 ++++++++
 .../cases/profiling/golang/profiling-analysis.yml  |  26 ++---
 test/e2e/cases/profiling/golang/sqrt.go            |  32 ++++++
 test/e2e/cases/profiling/profiling-cases.yaml      |  41 +++++++
 34 files changed, 883 insertions(+), 265 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 481e0b6..f4fefdc 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -35,7 +35,7 @@ github:
       required_status_checks:
         strict: true
         contexts:
-          - Build and Test
+          - Required
       required_pull_request_reviews:
         dismiss_stale_reviews: true
         required_approving_review_count: 1
diff --git a/.github/workflows/build-and-test.yaml 
b/.github/workflows/build-and-test.yaml
deleted file mode 100644
index cceb7a8..0000000
--- a/.github/workflows/build-and-test.yaml
+++ /dev/null
@@ -1,70 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) 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
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-
-name: Build and Test
-
-on:
-  pull_request:
-  push:
-    branches:
-      - main
-
-jobs:
-  build:
-    name: Build and Test
-    runs-on: ${{ matrix.runner }}-latest
-    timeout-minutes: 30
-    strategy:
-      matrix:
-        go-version: [ 1.17 ]
-        runner: [ ubuntu ]
-      fail-fast: true
-    steps:
-      - name: Set up Go ${{ matrix.go-version }}
-        uses: actions/setup-go@v2
-        with:
-          go-version: ${{ matrix.go-version }}
-      - name: Check out code into the Go module directory
-        uses: actions/checkout@v2
-        with:
-          submodules: true
-      - name: Check License
-        if: matrix.runner == 'ubuntu'
-        uses: apache/skywalking-eyes@9bd5feb86b5817aa6072b008f9866a2c3bbc8587
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-      - name: Get dependencies
-        run: make deps
-      - name: Generate
-        run: make container-generate
-      - name: Test
-        run: make container-test
-      - name: Lint
-        run: make container-lint
-      - name: Make binary
-        run: make linux
-      - name: Check CI Consistency
-        if: matrix.go-version == '1.17' && matrix.runner == 'ubuntu'
-        run: make check
-
-  result:
-    name: Build and Test
-    runs-on: ubuntu-latest
-    timeout-minutes: 30
-    needs: [ build ]
-    steps:
-      - name: Build Result
-        run: echo "Just to make the GitHub merge button green"
\ No newline at end of file
diff --git a/.github/workflows/rover.yaml b/.github/workflows/rover.yaml
new file mode 100644
index 0000000..d6edc2a
--- /dev/null
+++ b/.github/workflows/rover.yaml
@@ -0,0 +1,124 @@
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+name: CI
+
+on:
+  pull_request:
+
+jobs:
+  build:
+    name: Build and Test
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    steps:
+      - name: Set up Go 1.17
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v2
+        with:
+          submodules: true
+      - name: Check License
+        uses: apache/skywalking-eyes@9bd5feb86b5817aa6072b008f9866a2c3bbc8587
+      - name: Get dependencies
+        run: make deps
+      - name: Test
+        run: make container-test
+      - name: Lint
+        run: make container-lint
+      - name: Make binary
+        run: make linux
+      - name: Check CI Consistency
+        run: make check
+
+  docker:
+    name: Docker images
+    runs-on: ubuntu-latest
+    timeout-minutes: 30
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - name: Build and save docker images
+        run: |
+          make docker
+          docker save -o docker-images-skywalking-rover.tar 
apache/skywalking-rover:vlatest
+      - name: Upload docker images
+        uses: actions/upload-artifact@v2
+        with:
+          name: docker-images-skywalking-rover
+          path: docker-images-skywalking-rover.tar
+
+  e2e-test:
+    name: E2E test
+    needs: [ docker ]
+    runs-on: ubuntu-latest
+    timeout-minutes: 60
+    strategy:
+      fail-fast: false
+      matrix:
+        test:
+          - name: Golang Profiling
+            config: test/e2e/cases/profiling/golang/e2e.yaml
+          - name: C++ Profiling
+            config: test/e2e/cases/profiling/c++/e2e.yaml
+          - name: C Profiling
+            config: test/e2e/cases/profiling/c/e2e.yaml
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - uses: actions/download-artifact@v2
+        name: Download docker images
+        with:
+          name: docker-images-skywalking-rover
+          path: docker-images
+      - name: Load docker images
+        run: find docker-images -name "*.tar" -exec docker load -i {} \;
+      - name: Setup Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: '1.16'
+      - name: ${{ matrix.test.name }}
+        uses: apache/skywalking-infra-e2e@main
+        with:
+          e2e-file: $GITHUB_WORKSPACE/${{ matrix.test.config }}
+      - uses: actions/upload-artifact@v2
+        if: ${{ failure() }}
+        name: Upload Logs
+        with:
+          name: logs
+          path: "${{ env.SW_INFRA_E2E_LOG_DIR }}"
+
+  required:
+    if: always()
+    name: Required
+    needs:
+      - build
+      - e2e-test
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    steps:
+      - name: Merge Requirement
+        run: |
+          if [[ ${{ needs.build.result }} != 'success' ]]; then
+            exit -1
+          fi
+          if [[ ${{ needs.e2e-test.result }} != 'success' ]]; then
+            exit -1
+          fi
\ No newline at end of file
diff --git a/Makefile b/Makefile
index dc5d6a5..583b613 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ include scripts/build/test.mk
 include scripts/build/lint.mk
 include scripts/build/build.mk
 include scripts/build/check.mk
+include scripts/build/docker.mk
 
 .PHONY: all
 all: clean test lint build
diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build
new file mode 100644
index 0000000..f06ed33
--- /dev/null
+++ b/docker/Dockerfile.build
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+ARG BASE_IMAGE=apache/skywalking-rover:vlatest
+FROM $BASE_IMAGE as build
+
+ARG VERSION="latest"
+
+WORKDIR /src
+
+COPY . .
+
+ENV CGO_ENABLED=0
+
+RUN VERSION=$VERSION make generate && make linux
+RUN mv /src/bin/skywalking-rover-${VERSION}-linux-amd64 
/src/bin/skywalking-rover
+
+FROM scratch
+
+VOLUME /skywalking/configs
+
+WORKDIR /skywalking
+
+COPY --from=build /src/bin/skywalking-rover /
+COPY --from=build /src/configs /skywalking/configs
+
+CMD ["/skywalking-rover", "start", "--config", 
"/skywalking/configs/rover_configs.yaml"]
\ No newline at end of file
diff --git a/pkg/profiling/task/oncpu/runner.go 
b/pkg/profiling/task/oncpu/runner.go
index ba7b893..a929a90 100644
--- a/pkg/profiling/task/oncpu/runner.go
+++ b/pkg/profiling/task/oncpu/runner.go
@@ -71,7 +71,7 @@ type Runner struct {
        stackMap           *ebpf.Map
        stackNotFoundCache map[uint32]bool
        shutdownOnce       sync.Once
-       flushDataNotify    chan bool
+       flushDataNotify    context.CancelFunc
 }
 
 func NewRunner(config *base.TaskConfig) (base.ProfileTaskRunner, error) {
@@ -209,10 +209,10 @@ func (r *Runner) Stop() error {
                }
 
                // wait for all profiling data been consume finished
-               var flushDataNotify = make(chan bool)
-               r.flushDataNotify = flushDataNotify
+               cancel, cancelFunc := context.WithCancel(context.Background())
+               r.flushDataNotify = cancelFunc
                select {
-               case <-flushDataNotify:
+               case <-cancel.Done():
                case <-time.After(5 * time.Second):
                }
 
@@ -246,7 +246,7 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, 
error) {
 
                // close the flush data notify if exists
                if r.flushDataNotify != nil {
-                       r.flushDataNotify <- true
+                       r.flushDataNotify()
                }
 
                if len(metadatas) == 0 {
diff --git a/scripts/build/docker.mk b/scripts/build/docker.mk
new file mode 100644
index 0000000..75faa14
--- /dev/null
+++ b/scripts/build/docker.mk
@@ -0,0 +1,28 @@
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+HUB ?= apache
+
+.PHONY: docker
+docker: build-base-container
+       docker build --build-arg VERSION=$(VERSION) --build-arg 
BASE_IMAGE=${CONTAINER_COMMAND_IMAGE}:${CONTAINER_COMMAND_TAG} \
+               -t $(HUB)/skywalking-rover:v$(VERSION) --no-cache . -f 
docker/Dockerfile.build
+
+.PHONY: docker.push
+docker.push:
+       docker push $(HUB)/skywalking-rover:v$(VERSION)
\ No newline at end of file
diff --git a/test/e2e/base/base-compose.yml b/test/e2e/base/base-compose.yml
new file mode 100644
index 0000000..9d11bab
--- /dev/null
+++ b/test/e2e/base/base-compose.yml
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) 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 with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+version: '2.1'
+
+services:
+  oap:
+    image: ghcr.io/apache/skywalking/oap:latest
+    expose:
+      - 11800
+      - 12800
+      - 10051
+    networks:
+      - e2e
+    healthcheck:
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11800"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  rover:
+    image: apache/skywalking-rover:vlatest
+    networks:
+      - e2e
+    privileged: true
+    pid: host
+    environment:
+      ROVER_HOST_MAPPING: /host
+      ROVER_BACKEND_ADDR: oap:11800
+      ROVER_PROCESS_DISCOVERY_HEARTBEAT_PERIOD: 2s
+      ROVER_PROCESS_DISCOVERY_VM_ACTIVE: "true"
+      ROVER_PROCESS_DISCOVERY_VM_FINDER_MATCH_CMD_REGEX: sqrt
+      ROVER_PROCESS_DISCOVERY_VM_FINDER_LAYER: OS_LINUX
+      ROVER_PROCESS_DISCOVERY_VM_FINDER_SERVICE_NAME: sqrt
+      ROVER_PROCESS_DISCOVERY_VM_FINDER_INSTANCE_NAME: test-instance
+      ROVER_PROCESS_DISCOVERY_VM_FINDER_PROCESS_NAME: "{{.Process.ExeName}}"
+      ROVER_PROFILING_ACTIVE: "true"
+      ROVER_PROFILING_CHECK_INTERVAL: 2s
+      ROVER_PROFILING_FLUSH_INTERVAL: 5s
+      ROVER_PROFILING_TASK_ON_CPU_DUMP_PERIOD: 9ms
+    volumes:
+      - /:/host
+
+networks:
+  e2e:
\ No newline at end of file
diff --git a/Makefile b/test/e2e/base/env
similarity index 72%
copy from Makefile
copy to test/e2e/base/env
index dc5d6a5..0dfe380 100644
--- a/Makefile
+++ b/test/e2e/base/env
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,5 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+SW_CTL_COMMIT=60cee4a926a867a7bd934b7f94c9a8517e141608
diff --git a/test/e2e/base/scripts/prepare/setup-e2e-shell/install-swctl.sh 
b/test/e2e/base/scripts/prepare/setup-e2e-shell/install-swctl.sh
new file mode 100644
index 0000000..25f1ecd
--- /dev/null
+++ b/test/e2e/base/scripts/prepare/setup-e2e-shell/install-swctl.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+# ----------------------------------------------------------------------------
+
+BASE_DIR=$1
+BIN_DIR=$2
+
+if ! command -v swctl &> /dev/null; then
+  mkdir -p $BASE_DIR/swctl && cd $BASE_DIR/swctl
+  curl -kLo skywalking-cli.tar.gz 
https://github.com/apache/skywalking-cli/archive/${SW_CTL_COMMIT}.tar.gz
+  tar -zxf skywalking-cli.tar.gz --strip=1
+  make install DESTDIR=$BIN_DIR
+fi
\ No newline at end of file
diff --git a/test/e2e/base/scripts/prepare/setup-e2e-shell/install-yq.sh 
b/test/e2e/base/scripts/prepare/setup-e2e-shell/install-yq.sh
new file mode 100644
index 0000000..28fd299
--- /dev/null
+++ b/test/e2e/base/scripts/prepare/setup-e2e-shell/install-yq.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+# ----------------------------------------------------------------------------
+
+BASE_DIR=$1
+BIN_DIR=$2
+
+if ! command -v yq &> /dev/null; then
+  mkdir -p $BASE_DIR/yq && cd $BASE_DIR/yq
+  curl -kLo yq.tar.gz https://github.com/mikefarah/yq/archive/v4.11.1.tar.gz
+  tar -zxf yq.tar.gz --strip=1
+  go install && go build -ldflags -s && cp yq $BIN_DIR/
+fi
\ No newline at end of file
diff --git a/test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh 
b/test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh
new file mode 100644
index 0000000..3d440fa
--- /dev/null
+++ b/test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+# ----------------------------------------------------------------------------
+
+set -ex
+
+NAME=$1
+CURRENT_DIR="$(cd "$(dirname $0)"; pwd)"
+
+# prepare base dir
+TMP_DIR=/tmp/skywalking-infra-e2e
+BIN_DIR=/usr/local/bin
+mkdir -p $TMP_DIR && cd $TMP_DIR
+
+# execute install
+bash $CURRENT_DIR/install-$NAME.sh $TMP_DIR $BIN_DIR
+
+echo "success to install $NAME"
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/c++/Dockerfile.sqrt 
b/test/e2e/cases/profiling/c++/Dockerfile.sqrt
new file mode 100644
index 0000000..c75cdf2
--- /dev/null
+++ b/test/e2e/cases/profiling/c++/Dockerfile.sqrt
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+FROM gcc:latest
+
+WORKDIR /
+COPY sqrt.cpp /sqrt.cpp
+RUN  g++ sqrt.cpp -o sqrt
+
+CMD ["/sqrt"]
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/c++/docker-compose.yml
similarity index 65%
copy from Makefile
copy to test/e2e/cases/profiling/c++/docker-compose.yml
index dc5d6a5..ff5f760 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/c++/docker-compose.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,31 @@
 # 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.
-#
 
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
+version: '2.1'
+
+services:
+  oap:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: oap
+    ports:
+      - 12800:12800
+
+  rover:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: rover
+    depends_on:
+      oap:
+        condition: service_healthy
 
-.PHONY: all
-all: clean test lint build
+  sqrt_c_plus_plus:
+    build:
+      context: .
+      dockerfile: Dockerfile.sqrt
+    networks:
+      - e2e
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+networks:
+  e2e:
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/c++/e2e.yaml 
b/test/e2e/cases/profiling/c++/e2e.yaml
new file mode 100644
index 0000000..61c77e0
--- /dev/null
+++ b/test/e2e/cases/profiling/c++/e2e.yaml
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) 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 with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 20m
+  init-system-environment: ../../../base/env
+  steps:
+    - name: set PATH
+      command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+    - name: install yq
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq
+    - name: install swctl
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh 
swctl
+
+verify:
+  # verify with retry strategy
+  retry:
+    # max retry count
+    count: 20
+    # the interval between two retries, in millisecond.
+    interval: 10s
+  cases:
+    - includes:
+        - ../profiling-cases.yaml
+    - query: |
+        taskid=$(swctl --display yaml profiling ebpf list --process-id=$( \
+          swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' 
- \
+        ) |yq e '.[0].taskid' -);
+        start=$(swctl --display yaml profiling ebpf schedules 
--task-id=$taskid | yq e '.[0].starttime' -)
+        end=$(swctl --display yaml profiling ebpf schedules --task-id=$taskid 
| yq e '.[0].endtime' -)
+        swctl --display yaml profiling ebpf analysis --task-id=$taskid 
--time-ranges=$start-$end
+      expected: profiling-analysis.yml
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/c++/profiling-analysis.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/c++/profiling-analysis.yml
index dc5d6a5..962f0d0 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/c++/profiling-analysis.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,16 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+tip: null
+trees:
+{{- contains .trees }}
+- elements:
+  {{- contains .elements }}
+  - id: "{{ notEmpty .id }}"
+    parentid: "{{ notEmpty .parentid }}"
+    symbol: "sqrtCPlusPlus()"
+    stacktype: USER_SPACE
+    dumpcount: {{ gt .dumpcount 0 }}
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/c++/sqrt.cpp 
b/test/e2e/cases/profiling/c++/sqrt.cpp
new file mode 100644
index 0000000..c0db43f
--- /dev/null
+++ b/test/e2e/cases/profiling/c++/sqrt.cpp
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) 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
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+#include <cmath>
+using namespace std;
+void sqrtCPlusPlus()
+{
+    for (;;)
+    {
+        sqrt(10000);
+    }
+}
+
+int main()
+{
+    sqrtCPlusPlus();
+    return 0;
+}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/c/Dockerfile.sqrt 
b/test/e2e/cases/profiling/c/Dockerfile.sqrt
new file mode 100644
index 0000000..5f0150f
--- /dev/null
+++ b/test/e2e/cases/profiling/c/Dockerfile.sqrt
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+FROM gcc:latest
+
+WORKDIR /
+COPY sqrt.c /sqrt.c
+RUN gcc sqrt.c -o sqrt
+
+CMD ["/sqrt"]
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/c/docker-compose.yml
similarity index 66%
copy from Makefile
copy to test/e2e/cases/profiling/c/docker-compose.yml
index dc5d6a5..4742e13 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/c/docker-compose.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,31 @@
 # 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.
-#
 
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
+version: '2.1'
+
+services:
+  oap:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: oap
+    ports:
+      - 12800:12800
+
+  rover:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: rover
+    depends_on:
+      oap:
+        condition: service_healthy
 
-.PHONY: all
-all: clean test lint build
+  sqrt_c:
+    build:
+      context: .
+      dockerfile: Dockerfile.sqrt
+    networks:
+      - e2e
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+networks:
+  e2e:
diff --git a/test/e2e/cases/profiling/c/e2e.yaml 
b/test/e2e/cases/profiling/c/e2e.yaml
new file mode 100644
index 0000000..61c77e0
--- /dev/null
+++ b/test/e2e/cases/profiling/c/e2e.yaml
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) 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 with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 20m
+  init-system-environment: ../../../base/env
+  steps:
+    - name: set PATH
+      command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+    - name: install yq
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq
+    - name: install swctl
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh 
swctl
+
+verify:
+  # verify with retry strategy
+  retry:
+    # max retry count
+    count: 20
+    # the interval between two retries, in millisecond.
+    interval: 10s
+  cases:
+    - includes:
+        - ../profiling-cases.yaml
+    - query: |
+        taskid=$(swctl --display yaml profiling ebpf list --process-id=$( \
+          swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' 
- \
+        ) |yq e '.[0].taskid' -);
+        start=$(swctl --display yaml profiling ebpf schedules 
--task-id=$taskid | yq e '.[0].starttime' -)
+        end=$(swctl --display yaml profiling ebpf schedules --task-id=$taskid 
| yq e '.[0].endtime' -)
+        swctl --display yaml profiling ebpf analysis --task-id=$taskid 
--time-ranges=$start-$end
+      expected: profiling-analysis.yml
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/c/profiling-analysis.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/c/profiling-analysis.yml
index dc5d6a5..46a9d32 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/c/profiling-analysis.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,16 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+tip: null
+trees:
+{{- contains .trees }}
+- elements:
+  {{- contains .elements }}
+  - id: "{{ notEmpty .id }}"
+    parentid: "{{ notEmpty .parentid }}"
+    symbol: "sqrtC"
+    stacktype: USER_SPACE
+    dumpcount: {{ gt .dumpcount 0 }}
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/c/sqrt.c 
b/test/e2e/cases/profiling/c/sqrt.c
new file mode 100644
index 0000000..306c6b3
--- /dev/null
+++ b/test/e2e/cases/profiling/c/sqrt.c
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) 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
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+#include <math.h>
+void sqrtC()
+{
+   while (1)
+   {
+       sqrt(100.0);
+   }
+}
+
+int main() {
+   sqrtC();
+   return 0;
+}
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/expected/instance.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/expected/instance.yml
index dc5d6a5..b5c287a 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/expected/instance.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,12 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+{{- contains . }}
+- id: {{ b64enc "sqrt" }}.1_{{ b64enc "test-instance" }}
+  name: test-instance
+  attributes: []
+  language: UNKNOWN
+  instanceuuid: {{ notEmpty .instanceuuid }}
+  layer: OS_LINUX
+{{- end }}
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/expected/process.yml
similarity index 61%
copy from Makefile
copy to test/e2e/cases/profiling/expected/process.yml
index dc5d6a5..17f1911 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/expected/process.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,24 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+{{- contains . }}
+- id: {{ notEmpty .id }}
+  name: sqrt
+  serviceid: {{ b64enc "sqrt" }}.1
+  servicename: sqrt
+  instanceid: {{ b64enc "sqrt" }}.1_{{ b64enc "test-instance" }}
+  instancename: test-instance
+  layer: OS_LINUX
+  agentid: {{ notEmpty .agentid }}
+  detecttype: VM
+  attributes:
+    {{- contains .attributes }}
+    - name: host_ip
+      value: {{ notEmpty .value }}
+    - name: pid
+      value: {{ notEmpty .value }}
+    - name: command_line
+      value: /sqrt
+    {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/expected/profiling-create.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/expected/profiling-create.yml
index dc5d6a5..176b195 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/expected/profiling-create.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,7 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+status: true
+errorreason: null
+id: {{ notEmpty .id }}
\ No newline at end of file
diff --git a/.asf.yaml 
b/test/e2e/cases/profiling/expected/profiling-schedule-list.yml
similarity index 52%
copy from .asf.yaml
copy to test/e2e/cases/profiling/expected/profiling-schedule-list.yml
index 481e0b6..d1f788c 100644
--- a/.asf.yaml
+++ b/test/e2e/cases/profiling/expected/profiling-schedule-list.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,30 +12,29 @@
 # 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.
-#
-
-github:
-  description: The Collector Project of Apache SkyWalking based on the eBPF
-  homepage: https://skywalking.apache.org/
-  labels:
-    - skywalking
-    - observability
-    - apm
-    - service-mesh
-    - ebpf
-    - profile
-    - network
-  enabled_merge_buttons:
-    squash:  true
-    merge:   false
-    rebase:  false
-  protected_branches:
-    main:
-      required_status_checks:
-        strict: true
-        contexts:
-          - Build and Test
-      required_pull_request_reviews:
-        dismiss_stale_reviews: true
-        required_approving_review_count: 1
 
+{{- contains . }}
+- scheduleid: {{ notEmpty .scheduleid }}
+  taskid: {{ notEmpty .taskid }}
+  process:
+    id: {{ notEmpty .process.id }}
+    name: sqrt
+    serviceid: {{ b64enc "sqrt" }}.1
+    servicename: sqrt
+    instanceid: {{ b64enc "sqrt" }}.1_{{ b64enc "test-instance" }}
+    instancename: test-instance
+    layer: OS_LINUX
+    agentid: {{ notEmpty .process.agentid }}
+    detecttype: VM
+    attributes:
+      {{- contains .process.attributes }}
+      - name: host_ip
+        value: {{ notEmpty .value }}
+      - name: pid
+        value: {{ notEmpty .value }}
+      - name: command_line
+        value: /sqrt
+      {{- end }}
+  starttime: {{ gt .starttime 0 }}
+  endtime: {{ gt .endtime 0 }}
+{{- end }}
\ No newline at end of file
diff --git a/Makefile 
b/test/e2e/cases/profiling/expected/profiling-task-list.yml
similarity index 63%
copy from Makefile
copy to test/e2e/cases/profiling/expected/profiling-task-list.yml
index dc5d6a5..05abb5e 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/expected/profiling-task-list.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,19 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+{{- contains . }}
+- taskid: {{ notEmpty .taskid }}
+  processfindertype: PROCESS_ID
+  serviceid: {{ b64enc "sqrt" }}.1
+  servicename: sqrt
+  instanceid: {{ b64enc "sqrt" }}.1_{{ b64enc "test-instance" }}
+  instancename: test-instance
+  processid: {{ notEmpty .processid }}
+  processname: sqrt
+  taskstarttime: {{ gt .taskstarttime 0 }}
+  triggertype: FIXED_TIME
+  fixedtriggerduration: 60
+  targettype: ON_CPU
+  createtime: {{ gt .createtime 0 }}
+{{- end }}
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/expected/service.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/expected/service.yml
index dc5d6a5..4c0ee2b 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/expected/service.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,13 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+{{- contains . }}
+- id: {{ b64enc "sqrt" }}.1
+  name: sqrt
+  group: ""
+  shortname: sqrt
+  layers:
+    - OS_LINUX
+  normal: true
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/golang/Dockerfile.sqrt 
b/test/e2e/cases/profiling/golang/Dockerfile.sqrt
new file mode 100644
index 0000000..432e696
--- /dev/null
+++ b/test/e2e/cases/profiling/golang/Dockerfile.sqrt
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) 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
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+FROM golang:1.17
+
+WORKDIR /
+COPY sqrt.go /sqrt.go
+RUN go build -o sqrt sqrt.go
+
+CMD ["/sqrt"]
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/golang/docker-compose.yml
similarity index 66%
copy from Makefile
copy to test/e2e/cases/profiling/golang/docker-compose.yml
index dc5d6a5..1f5369f 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/golang/docker-compose.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,31 @@
 # 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.
-#
 
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
+version: '2.1'
+
+services:
+  oap:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: oap
+    ports:
+      - 12800:12800
+
+  rover:
+    extends:
+      file: ../../../base/base-compose.yml
+      service: rover
+    depends_on:
+      oap:
+        condition: service_healthy
 
-.PHONY: all
-all: clean test lint build
+  sqrt_go:
+    build:
+      context: .
+      dockerfile: Dockerfile.sqrt
+    networks:
+      - e2e
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+networks:
+  e2e:
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/golang/e2e.yaml 
b/test/e2e/cases/profiling/golang/e2e.yaml
new file mode 100644
index 0000000..61c77e0
--- /dev/null
+++ b/test/e2e/cases/profiling/golang/e2e.yaml
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) 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 with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 20m
+  init-system-environment: ../../../base/env
+  steps:
+    - name: set PATH
+      command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+    - name: install yq
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq
+    - name: install swctl
+      command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh 
swctl
+
+verify:
+  # verify with retry strategy
+  retry:
+    # max retry count
+    count: 20
+    # the interval between two retries, in millisecond.
+    interval: 10s
+  cases:
+    - includes:
+        - ../profiling-cases.yaml
+    - query: |
+        taskid=$(swctl --display yaml profiling ebpf list --process-id=$( \
+          swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' 
- \
+        ) |yq e '.[0].taskid' -);
+        start=$(swctl --display yaml profiling ebpf schedules 
--task-id=$taskid | yq e '.[0].starttime' -)
+        end=$(swctl --display yaml profiling ebpf schedules --task-id=$taskid 
| yq e '.[0].endtime' -)
+        swctl --display yaml profiling ebpf analysis --task-id=$taskid 
--time-ranges=$start-$end
+      expected: profiling-analysis.yml
\ No newline at end of file
diff --git a/Makefile b/test/e2e/cases/profiling/golang/profiling-analysis.yml
similarity index 72%
copy from Makefile
copy to test/e2e/cases/profiling/golang/profiling-analysis.yml
index dc5d6a5..c8fe9d3 100644
--- a/Makefile
+++ b/test/e2e/cases/profiling/golang/profiling-analysis.yml
@@ -1,4 +1,3 @@
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -13,17 +12,16 @@
 # 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.
-#
-
-include scripts/build/base.mk
-include scripts/build/generate.mk
-include scripts/build/test.mk
-include scripts/build/lint.mk
-include scripts/build/build.mk
-include scripts/build/check.mk
-
-.PHONY: all
-all: clean test lint build
 
-.PHONY: container-all
-container-all: clean container-generate build
\ No newline at end of file
+tip: null
+trees:
+{{- contains .trees }}
+- elements:
+  {{- contains .elements }}
+  - id: "{{ notEmpty .id }}"
+    parentid: "{{ notEmpty .parentid }}"
+    symbol: "main.sqrtGolang"
+    stacktype: USER_SPACE
+    dumpcount: {{ gt .dumpcount 0 }}
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/golang/sqrt.go 
b/test/e2e/cases/profiling/golang/sqrt.go
new file mode 100644
index 0000000..1fc3d01
--- /dev/null
+++ b/test/e2e/cases/profiling/golang/sqrt.go
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) 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
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+package main
+
+import (
+       "math"
+)
+
+//go:noinline
+func sqrtGolang() {
+       for {
+               math.Sqrt(10000)
+       }
+}
+
+func main() {
+       sqrtGolang()
+}
diff --git a/test/e2e/cases/profiling/profiling-cases.yaml 
b/test/e2e/cases/profiling/profiling-cases.yaml
new file mode 100644
index 0000000..9b0bf33
--- /dev/null
+++ b/test/e2e/cases/profiling/profiling-cases.yaml
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) 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 with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+cases:
+  - query: swctl --display yaml service ls
+    expected: expected/service.yml
+  - query: swctl --display yaml instance ls --service-name sqrt
+    expected: expected/instance.yml
+  - query: swctl --display yaml process ls --service-name sqrt
+    expected: expected/process.yml
+  - query: |
+      swctl --display yaml profiling ebpf create fixed --process-id=$( \
+        swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' - \
+      ) --duration=1m
+    expected: expected/profiling-create.yml
+  - query: |
+      swctl --display yaml profiling ebpf list --process-id=$( \
+        swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' - \
+      )
+    expected: expected/profiling-task-list.yml
+  - query: |
+      swctl --display yaml profiling ebpf schedules --task-id=$( \
+        swctl --display yaml profiling ebpf list --process-id=$( \
+          swctl --display yaml process ls --service-name sqrt| yq e '.[0].id' 
- \
+        ) |yq e '.[0].taskid' - \
+      )
+    expected: expected/profiling-schedule-list.yml
\ No newline at end of file

Reply via email to