From 6c46325b466f35d40c2ed1043bfdfcfb8a367a34 Mon Sep 17 00:00:00 2001 From: Johannes Holland Date: Fri, 17 May 2024 16:39:37 +0200 Subject: [PATCH] IDE support: add _vscode with launch.json and tasks.json Add _vscode which can be renamed to .vscode. It contains a launch.json for executing the unit and integration tests (when they are the currently active editor tab). Additionally, launch.json contains the relevant build tasks. Signed-off-by: Johannes Holland --- _vscode/launch.json | 53 +++++++++++++++++++++++++++++++++++++++++++++ _vscode/tasks.json | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 _vscode/launch.json create mode 100644 _vscode/tasks.json diff --git a/_vscode/launch.json b/_vscode/launch.json new file mode 100644 index 000000000..f89175a88 --- /dev/null +++ b/_vscode/launch.json @@ -0,0 +1,53 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug Test", + "program": "${workspaceFolder}/${relativeFileDirname}/.libs/${fileBasenameNoExtension}", + "args": [], + "cwd": "${workspaceFolder}", + "env": { + "TPM20TEST_TCTI": "${input:tcti}", + "TSS2_LOG": "all+trace", + "LD_LIBRARY_PATH": "${workspaceFolder}/src/tss2-mu/.libs:${workspaceFolder}/src/tss2-tcti/.libs:${workspaceFolder}/src/tss2-sys/.libs:${workspaceFolder}/src/tss2-esys/.libs:${workspaceFolder}/src/tss2-rc/.libs:${workspaceFolder}/src/tss2-policy/.libs:${workspaceFolder}/src/tss2-fapi/.libs" + }, + "preLaunchTask": "build_test", + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug tpm2 startup", + "program": "/bin/env", + "args": [ + "tpm2", + "startup", + "-c", + "-T${input:tcti}", + ], + "cwd": "${workspaceFolder}", + "env": { + "TSS2_LOG": "all+trace", + "LD_LIBRARY_PATH": "${workspaceFolder}/src/tss2-mu/.libs:${workspaceFolder}/src/tss2-tcti/.libs:${workspaceFolder}/src/tss2-sys/.libs:${workspaceFolder}/src/tss2-esys/.libs:${workspaceFolder}/src/tss2-rc/.libs:${workspaceFolder}/src/tss2-policy/.libs:${workspaceFolder}/src/tss2-fapi/.libs" + }, + "preLaunchTask": "build_tcti_libtpms", + }, + ], + "inputs": [ + { + "id": "tcti", + "type": "pickString", + "description": "The TCTI for connecting to a TPM", + "options": [ + "libtpms", + "swtpm", + "mssim" + ], + "default": "libtpms" + } + ] +} \ No newline at end of file diff --git a/_vscode/tasks.json b/_vscode/tasks.json new file mode 100644 index 000000000..e90744418 --- /dev/null +++ b/_vscode/tasks.json @@ -0,0 +1,39 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "label": "build_test", + "command": "make", + "args": [ + "-j", + "${relativeFileDirname}/${fileBasenameNoExtension}", + ], + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Build single test executable." + }, + { + "type": "shell", + "label": "build_tcti_libtpms", + "command": "make", + "args": [ + "-j", + "src/tss2-tcti/libtss2-tcti-libtpms.la", + ], + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": false + }, + "detail": "Build tcti-libtpms" + } + ] +} \ No newline at end of file