@datadog/datadog-ci 2.40.3 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/deployment/cli.js +2 -1
- package/dist/commands/deployment/cli.js.map +1 -1
- package/dist/commands/deployment/correlate.d.ts +18 -0
- package/dist/commands/deployment/correlate.js +154 -0
- package/dist/commands/deployment/correlate.js.map +1 -0
- package/dist/commands/dsyms/utils.js +2 -4
- package/dist/commands/dsyms/utils.js.map +1 -1
- package/dist/commands/elf-symbols/elf.d.ts +5 -3
- package/dist/commands/elf-symbols/elf.js +18 -16
- package/dist/commands/elf-symbols/elf.js.map +1 -1
- package/dist/commands/elf-symbols/helpers.js +1 -1
- package/dist/commands/elf-symbols/interfaces.d.ts +6 -2
- package/dist/commands/elf-symbols/upload.d.ts +3 -0
- package/dist/commands/elf-symbols/upload.js +46 -22
- package/dist/commands/elf-symbols/upload.js.map +1 -1
- package/dist/commands/sarif/renderer.d.ts +1 -1
- package/dist/commands/sarif/renderer.js +5 -2
- package/dist/commands/sarif/renderer.js.map +1 -1
- package/dist/commands/sarif/upload.d.ts +1 -0
- package/dist/commands/sarif/upload.js +12 -35
- package/dist/commands/sarif/upload.js.map +1 -1
- package/dist/commands/sarif/validation.d.ts +15 -0
- package/dist/commands/sarif/validation.js +78 -0
- package/dist/commands/sarif/validation.js.map +1 -0
- package/dist/commands/sbom/upload.d.ts +1 -0
- package/dist/commands/sbom/upload.js +6 -14
- package/dist/commands/sbom/upload.js.map +1 -1
- package/dist/commands/synthetics/batch.js +3 -2
- package/dist/commands/synthetics/batch.js.map +1 -1
- package/dist/commands/synthetics/compatibility.d.ts +2 -2
- package/dist/commands/synthetics/compatibility.js +26 -26
- package/dist/commands/synthetics/compatibility.js.map +1 -1
- package/dist/commands/synthetics/interfaces.d.ts +3 -2
- package/dist/commands/synthetics/interfaces.js.map +1 -1
- package/dist/commands/synthetics/reporters/junit.d.ts +1 -0
- package/dist/commands/synthetics/reporters/junit.js +1 -0
- package/dist/commands/synthetics/reporters/junit.js.map +1 -1
- package/dist/commands/synthetics/run-tests-command.d.ts +1 -0
- package/dist/commands/synthetics/run-tests-command.js +25 -17
- package/dist/commands/synthetics/run-tests-command.js.map +1 -1
- package/dist/commands/synthetics/utils/internal.d.ts +4 -0
- package/dist/commands/synthetics/utils/internal.js +37 -2
- package/dist/commands/synthetics/utils/internal.js.map +1 -1
- package/dist/commands/synthetics/utils/public.d.ts +3 -0
- package/dist/commands/synthetics/utils/public.js +3 -0
- package/dist/commands/synthetics/utils/public.js.map +1 -1
- package/dist/helpers/git/get-git-data.d.ts +2 -0
- package/dist/helpers/git/get-git-data.js +11 -1
- package/dist/helpers/git/get-git-data.js.map +1 -1
- package/dist/helpers/tags.d.ts +2 -1
- package/dist/helpers/tags.js +3 -2
- package/dist/helpers/tags.js.map +1 -1
- package/package.json +14 -12
- package/dist/__tests__/cli.test.d.ts +0 -1
- package/dist/__tests__/cli.test.js +0 -41
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/fixtures.d.ts +0 -2
- package/dist/commands/cloud-run/__tests__/fixtures.js +0 -12
- package/dist/commands/cloud-run/__tests__/fixtures.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.js +0 -557
- package/dist/commands/cloud-run/__tests__/flare.test.js.map +0 -1
- package/dist/commands/deployment/__tests__/mark.test.d.ts +0 -1
- package/dist/commands/deployment/__tests__/mark.test.js +0 -47
- package/dist/commands/deployment/__tests__/mark.test.js.map +0 -1
- package/dist/commands/dora/__tests__/deployment.test.d.ts +0 -1
- package/dist/commands/dora/__tests__/deployment.test.js +0 -201
- package/dist/commands/dora/__tests__/deployment.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.js +0 -346
- package/dist/commands/dsyms/__tests__/upload.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.js +0 -103
- package/dist/commands/dsyms/__tests__/utils.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.js +0 -813
- package/dist/commands/elf-symbols/__tests__/elf.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.js +0 -249
- package/dist/commands/elf-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.js +0 -617
- package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.js +0 -398
- package/dist/commands/gate/__tests__/evaluate.test.js.map +0 -1
- package/dist/commands/gate/__tests__/scope.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/scope.test.js +0 -29
- package/dist/commands/gate/__tests__/scope.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.js +0 -132
- package/dist/commands/git-metadata/__tests__/git.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.js +0 -1386
- package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.js +0 -118
- package/dist/commands/git-metadata/__tests__/library.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.js +0 -52
- package/dist/commands/git-metadata/__tests__/upload.test.js.map +0 -1
- package/dist/commands/junit/__tests__/id.test.d.ts +0 -1
- package/dist/commands/junit/__tests__/id.test.js +0 -24
- package/dist/commands/junit/__tests__/id.test.js.map +0 -1
- package/dist/commands/junit/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/junit/__tests__/upload.test.js +0 -495
- package/dist/commands/junit/__tests__/upload.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/fixtures.d.ts +0 -51
- package/dist/commands/lambda/__tests__/fixtures.js +0 -146
- package/dist/commands/lambda/__tests__/fixtures.js.map +0 -1
- package/dist/commands/lambda/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/flare.test.js +0 -730
- package/dist/commands/lambda/__tests__/flare.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -791
- package/dist/commands/lambda/__tests__/functions/commons.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +0 -386
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +0 -721
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +0 -513
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +0 -33
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.js +0 -1511
- package/dist/commands/lambda/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.js +0 -340
- package/dist/commands/lambda/__tests__/loggroup.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.js +0 -206
- package/dist/commands/lambda/__tests__/prompt.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/tags.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/tags.test.js +0 -305
- package/dist/commands/lambda/__tests__/tags.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.js +0 -722
- package/dist/commands/lambda/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/measure/__tests__/measure.test.d.ts +0 -1
- package/dist/commands/measure/__tests__/measure.test.js +0 -110
- package/dist/commands/measure/__tests__/measure.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.js +0 -161
- package/dist/commands/react-native/__tests__/codepush.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.js +0 -33
- package/dist/commands/react-native/__tests__/interfaces.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/upload.test.js +0 -238
- package/dist/commands/react-native/__tests__/upload.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/utils.test.js +0 -27
- package/dist/commands/react-native/__tests__/utils.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.js +0 -465
- package/dist/commands/react-native/__tests__/xcode.test.js.map +0 -1
- package/dist/commands/sarif/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sarif/__tests__/upload.test.js +0 -228
- package/dist/commands/sarif/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/payload.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/payload.test.js +0 -262
- package/dist/commands/sbom/__tests__/payload.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/validation.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/validation.test.js +0 -41
- package/dist/commands/sbom/__tests__/validation.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.js +0 -270
- package/dist/commands/sourcemaps/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.js +0 -31
- package/dist/commands/sourcemaps/__tests__/utils.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +0 -192
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +0 -6
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +0 -45
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +0 -5
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +0 -19
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.js +0 -205
- package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.js +0 -431
- package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +0 -166
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/api.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/api.test.js +0 -422
- package/dist/commands/synthetics/__tests__/api.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.js +0 -1325
- package/dist/commands/synthetics/__tests__/cli.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/fixtures.d.ts +0 -149
- package/dist/commands/synthetics/__tests__/fixtures.js +0 -507
- package/dist/commands/synthetics/__tests__/fixtures.js.map +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.js +0 -376
- package/dist/commands/synthetics/__tests__/mobile.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.js +0 -354
- package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js +0 -353
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +0 -232
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +0 -735
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/test.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/test.test.js +0 -33
- package/dist/commands/synthetics/__tests__/test.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +0 -21
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +0 -80
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +0 -109
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.js +0 -186
- package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.js +0 -1526
- package/dist/commands/synthetics/__tests__/utils/public.test.js.map +0 -1
- package/dist/commands/tag/__tests__/tag.test.d.ts +0 -1
- package/dist/commands/tag/__tests__/tag.test.js +0 -75
- package/dist/commands/tag/__tests__/tag.test.js.map +0 -1
- package/dist/commands/trace/__tests__/trace.test.d.ts +0 -1
- package/dist/commands/trace/__tests__/trace.test.js +0 -145
- package/dist/commands/trace/__tests__/trace.test.js.map +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.js +0 -369
- package/dist/commands/unity-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/app.test.d.ts +0 -1
- package/dist/helpers/__tests__/app.test.js +0 -31
- package/dist/helpers/__tests__/app.test.js.map +0 -1
- package/dist/helpers/__tests__/ci.test.d.ts +0 -1
- package/dist/helpers/__tests__/ci.test.js +0 -252
- package/dist/helpers/__tests__/ci.test.js.map +0 -1
- package/dist/helpers/__tests__/fixtures.d.ts +0 -33
- package/dist/helpers/__tests__/fixtures.js +0 -71
- package/dist/helpers/__tests__/fixtures.js.map +0 -1
- package/dist/helpers/__tests__/flare.test.d.ts +0 -1
- package/dist/helpers/__tests__/flare.test.js +0 -226
- package/dist/helpers/__tests__/flare.test.js.map +0 -1
- package/dist/helpers/__tests__/fs.test.d.ts +0 -1
- package/dist/helpers/__tests__/fs.test.js +0 -189
- package/dist/helpers/__tests__/fs.test.js.map +0 -1
- package/dist/helpers/__tests__/plist.test.d.ts +0 -1
- package/dist/helpers/__tests__/plist.test.js +0 -43
- package/dist/helpers/__tests__/plist.test.js.map +0 -1
- package/dist/helpers/__tests__/prompt.test.d.ts +0 -1
- package/dist/helpers/__tests__/prompt.test.js +0 -71
- package/dist/helpers/__tests__/prompt.test.js.map +0 -1
- package/dist/helpers/__tests__/retry.test.d.ts +0 -1
- package/dist/helpers/__tests__/retry.test.js +0 -99
- package/dist/helpers/__tests__/retry.test.js.map +0 -1
- package/dist/helpers/__tests__/tags.test.d.ts +0 -1
- package/dist/helpers/__tests__/tags.test.js +0 -71
- package/dist/helpers/__tests__/tags.test.js.map +0 -1
- package/dist/helpers/__tests__/upload.test.d.ts +0 -1
- package/dist/helpers/__tests__/upload.test.js +0 -231
- package/dist/helpers/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.d.ts +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.js +0 -119
- package/dist/helpers/__tests__/user-provided-git.test.js.map +0 -1
- package/dist/helpers/__tests__/utils.test.d.ts +0 -1
- package/dist/helpers/__tests__/utils.test.js +0 -429
- package/dist/helpers/__tests__/utils.test.js.map +0 -1
- package/dist/helpers/__tests__/validation.test.d.ts +0 -1
- package/dist/helpers/__tests__/validation.test.js +0 -25
- package/dist/helpers/__tests__/validation.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +0 -103
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.js +0 -121
- package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.js +0 -72
- package/dist/helpers/git/__tests__/get-git-data.test.js.map +0 -1
|
@@ -1,813 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const utils_1 = require("../../dsyms/utils");
|
|
17
|
-
const elf_1 = require("../elf");
|
|
18
|
-
const elf_constants_1 = require("../elf-constants");
|
|
19
|
-
const fixtureDir = './src/commands/elf-symbols/__tests__/fixtures';
|
|
20
|
-
describe('elf', () => {
|
|
21
|
-
describe('readElfHeader', () => {
|
|
22
|
-
const getElfHeader = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
const reader = yield (0, elf_1.createReaderFromFile)(filename);
|
|
24
|
-
const elfResult = yield (0, elf_1.readElfHeader)(reader);
|
|
25
|
-
return elfResult;
|
|
26
|
-
});
|
|
27
|
-
test('throw an error if file does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
yield expect(getElfHeader(`${fixtureDir}/non_existing_file`)).rejects.toThrow();
|
|
29
|
-
}));
|
|
30
|
-
test('return false if file is not an ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const result = yield getElfHeader(`${fixtureDir}/non_elf_file`);
|
|
32
|
-
expect(result.isElf).toBeFalsy();
|
|
33
|
-
expect(result.error).toBeUndefined();
|
|
34
|
-
expect(result.elfHeader).toBeUndefined();
|
|
35
|
-
}));
|
|
36
|
-
test('return correct header if file is a DYN ELF aarch64 file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
const result = yield getElfHeader(`${fixtureDir}/dyn_aarch64`);
|
|
38
|
-
expect(result.isElf).toBeTruthy();
|
|
39
|
-
expect(result.error).toBeUndefined();
|
|
40
|
-
expect(result.elfHeader).toBeDefined();
|
|
41
|
-
expect(result.elfHeader).toEqual({
|
|
42
|
-
abi: 0,
|
|
43
|
-
abiVersion: 0,
|
|
44
|
-
data: 1,
|
|
45
|
-
elfClass: elf_constants_1.ElfClass.ELFCLASS64,
|
|
46
|
-
elfVersion: 1,
|
|
47
|
-
littleEndian: true,
|
|
48
|
-
e_type: elf_constants_1.ElfFileType.ET_DYN,
|
|
49
|
-
e_machine: elf_constants_1.MachineType.EM_AARCH64,
|
|
50
|
-
e_version: 1,
|
|
51
|
-
e_entry: BigInt(0),
|
|
52
|
-
e_phoff: BigInt(64),
|
|
53
|
-
e_shoff: BigInt(6896),
|
|
54
|
-
e_flags: 0,
|
|
55
|
-
e_ehsize: 64,
|
|
56
|
-
e_phentsize: 56,
|
|
57
|
-
e_phnum: 7,
|
|
58
|
-
e_shentsize: 64,
|
|
59
|
-
e_shnum: 30,
|
|
60
|
-
e_shstrndx: 29,
|
|
61
|
-
});
|
|
62
|
-
}));
|
|
63
|
-
test('return correct header if file is a EXEC ELF aarch64 file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
const result = yield getElfHeader(`${fixtureDir}/exec_aarch64`);
|
|
65
|
-
expect(result.isElf).toBeTruthy();
|
|
66
|
-
expect(result.error).toBeUndefined();
|
|
67
|
-
expect(result.elfHeader).toBeDefined();
|
|
68
|
-
expect(result.elfHeader).toEqual({
|
|
69
|
-
abi: 0,
|
|
70
|
-
abiVersion: 0,
|
|
71
|
-
data: 1,
|
|
72
|
-
elfClass: elf_constants_1.ElfClass.ELFCLASS64,
|
|
73
|
-
elfVersion: 1,
|
|
74
|
-
littleEndian: true,
|
|
75
|
-
e_type: elf_constants_1.ElfFileType.ET_EXEC,
|
|
76
|
-
e_machine: elf_constants_1.MachineType.EM_AARCH64,
|
|
77
|
-
e_version: 1,
|
|
78
|
-
e_entry: BigInt(0x400480),
|
|
79
|
-
e_phoff: BigInt(64),
|
|
80
|
-
e_shoff: BigInt(7704),
|
|
81
|
-
e_flags: 0,
|
|
82
|
-
e_ehsize: 64,
|
|
83
|
-
e_phentsize: 56,
|
|
84
|
-
e_phnum: 9,
|
|
85
|
-
e_shentsize: 64,
|
|
86
|
-
e_shnum: 35,
|
|
87
|
-
e_shstrndx: 34,
|
|
88
|
-
});
|
|
89
|
-
}));
|
|
90
|
-
test('return correct header if file is a DYN ELF x86_64 file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
|
-
const result = yield getElfHeader(`${fixtureDir}/go_x86_64_only_go_build_id`);
|
|
92
|
-
expect(result.isElf).toBeTruthy();
|
|
93
|
-
expect(result.error).toBeUndefined();
|
|
94
|
-
expect(result.elfHeader).toBeDefined();
|
|
95
|
-
expect(result.elfHeader).toEqual({
|
|
96
|
-
abi: 0,
|
|
97
|
-
abiVersion: 0,
|
|
98
|
-
data: 1,
|
|
99
|
-
elfClass: elf_constants_1.ElfClass.ELFCLASS64,
|
|
100
|
-
elfVersion: 1,
|
|
101
|
-
littleEndian: true,
|
|
102
|
-
e_type: elf_constants_1.ElfFileType.ET_DYN,
|
|
103
|
-
e_machine: elf_constants_1.MachineType.EM_X86_64,
|
|
104
|
-
e_version: 1,
|
|
105
|
-
e_entry: BigInt(0x1060),
|
|
106
|
-
e_phoff: BigInt(64),
|
|
107
|
-
e_shoff: BigInt(13584),
|
|
108
|
-
e_flags: 0,
|
|
109
|
-
e_ehsize: 64,
|
|
110
|
-
e_phentsize: 56,
|
|
111
|
-
e_phnum: 10,
|
|
112
|
-
e_shentsize: 64,
|
|
113
|
-
e_shnum: 30,
|
|
114
|
-
e_shstrndx: 29,
|
|
115
|
-
});
|
|
116
|
-
}));
|
|
117
|
-
test('return correct header if file is a EXEC ELF arm big endian file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
-
const result = yield getElfHeader(`${fixtureDir}/exec_arm_big`);
|
|
119
|
-
expect(result.isElf).toBeTruthy();
|
|
120
|
-
expect(result.error).toBeUndefined();
|
|
121
|
-
expect(result.elfHeader).toBeDefined();
|
|
122
|
-
expect(result.elfHeader).toEqual({
|
|
123
|
-
abi: 0,
|
|
124
|
-
abiVersion: 0,
|
|
125
|
-
data: 2,
|
|
126
|
-
elfClass: elf_constants_1.ElfClass.ELFCLASS32,
|
|
127
|
-
elfVersion: 1,
|
|
128
|
-
littleEndian: false,
|
|
129
|
-
e_type: elf_constants_1.ElfFileType.ET_EXEC,
|
|
130
|
-
e_machine: elf_constants_1.MachineType.EM_ARM,
|
|
131
|
-
e_version: 1,
|
|
132
|
-
e_entry: BigInt(0x8118),
|
|
133
|
-
e_phoff: BigInt(52),
|
|
134
|
-
e_shoff: BigInt(247844),
|
|
135
|
-
e_flags: 0x5000200,
|
|
136
|
-
e_ehsize: 52,
|
|
137
|
-
e_phentsize: 32,
|
|
138
|
-
e_phnum: 4,
|
|
139
|
-
e_shentsize: 40,
|
|
140
|
-
e_shnum: 25,
|
|
141
|
-
e_shstrndx: 24,
|
|
142
|
-
});
|
|
143
|
-
}));
|
|
144
|
-
});
|
|
145
|
-
describe('readElfSectionHeaderTable', () => {
|
|
146
|
-
test('return section header table for ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
-
const reader = yield (0, elf_1.createReaderFromFile)(`${fixtureDir}/dyn_aarch64`);
|
|
148
|
-
const elfResult = yield (0, elf_1.readElfHeader)(reader);
|
|
149
|
-
const sectionHeaders = yield (0, elf_1.readElfSectionHeaderTable)(reader, elfResult.elfHeader);
|
|
150
|
-
expect(sectionHeaders).toEqual([
|
|
151
|
-
{
|
|
152
|
-
name: '',
|
|
153
|
-
sh_name: 0,
|
|
154
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_NULL,
|
|
155
|
-
sh_flags: BigInt(0),
|
|
156
|
-
sh_addr: BigInt(0),
|
|
157
|
-
sh_offset: BigInt(0),
|
|
158
|
-
sh_size: BigInt(0),
|
|
159
|
-
sh_link: 0,
|
|
160
|
-
sh_info: 0,
|
|
161
|
-
sh_addralign: BigInt(0),
|
|
162
|
-
sh_entsize: BigInt(0),
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: '.note.gnu.build-id',
|
|
166
|
-
sh_name: 27,
|
|
167
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_NOTE,
|
|
168
|
-
sh_flags: BigInt(2),
|
|
169
|
-
sh_addr: BigInt(0x1c8),
|
|
170
|
-
sh_offset: BigInt(0x1c8),
|
|
171
|
-
sh_size: BigInt(0x24),
|
|
172
|
-
sh_link: 0,
|
|
173
|
-
sh_info: 0,
|
|
174
|
-
sh_addralign: BigInt(0x4),
|
|
175
|
-
sh_entsize: BigInt(0),
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: '.gnu.hash',
|
|
179
|
-
sh_addr: BigInt(496),
|
|
180
|
-
sh_addralign: BigInt(8),
|
|
181
|
-
sh_entsize: BigInt(0),
|
|
182
|
-
sh_flags: BigInt(2),
|
|
183
|
-
sh_info: 0,
|
|
184
|
-
sh_link: 3,
|
|
185
|
-
sh_name: 46,
|
|
186
|
-
sh_offset: BigInt(496),
|
|
187
|
-
sh_size: BigInt(36),
|
|
188
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_GNU_HASH,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: '.dynsym',
|
|
192
|
-
sh_addr: BigInt(536),
|
|
193
|
-
sh_addralign: BigInt(8),
|
|
194
|
-
sh_entsize: BigInt(24),
|
|
195
|
-
sh_flags: BigInt(2),
|
|
196
|
-
sh_info: 3,
|
|
197
|
-
sh_link: 4,
|
|
198
|
-
sh_name: 56,
|
|
199
|
-
sh_offset: BigInt(536),
|
|
200
|
-
sh_size: BigInt(192),
|
|
201
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_DYNSYM,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: '.dynstr',
|
|
205
|
-
sh_addr: BigInt(728),
|
|
206
|
-
sh_addralign: BigInt(1),
|
|
207
|
-
sh_entsize: BigInt(0),
|
|
208
|
-
sh_flags: BigInt(2),
|
|
209
|
-
sh_info: 0,
|
|
210
|
-
sh_link: 0,
|
|
211
|
-
sh_name: 64,
|
|
212
|
-
sh_offset: BigInt(728),
|
|
213
|
-
sh_size: BigInt(90),
|
|
214
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_STRTAB,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: '.rela.dyn',
|
|
218
|
-
sh_addr: BigInt(824),
|
|
219
|
-
sh_addralign: BigInt(8),
|
|
220
|
-
sh_entsize: BigInt(24),
|
|
221
|
-
sh_flags: BigInt(2),
|
|
222
|
-
sh_info: 0,
|
|
223
|
-
sh_link: 3,
|
|
224
|
-
sh_name: 72,
|
|
225
|
-
sh_offset: BigInt(824),
|
|
226
|
-
sh_size: BigInt(168),
|
|
227
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_RELA,
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: '.rela.plt',
|
|
231
|
-
sh_addr: BigInt(992),
|
|
232
|
-
sh_addralign: BigInt(8),
|
|
233
|
-
sh_entsize: BigInt(24),
|
|
234
|
-
sh_flags: BigInt(66),
|
|
235
|
-
sh_info: 17,
|
|
236
|
-
sh_link: 3,
|
|
237
|
-
sh_name: 82,
|
|
238
|
-
sh_offset: BigInt(992),
|
|
239
|
-
sh_size: BigInt(48),
|
|
240
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_RELA,
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: '.init',
|
|
244
|
-
sh_addr: BigInt(1040),
|
|
245
|
-
sh_addralign: BigInt(4),
|
|
246
|
-
sh_entsize: BigInt(0),
|
|
247
|
-
sh_flags: BigInt(6),
|
|
248
|
-
sh_info: 0,
|
|
249
|
-
sh_link: 0,
|
|
250
|
-
sh_name: 92,
|
|
251
|
-
sh_offset: BigInt(1040),
|
|
252
|
-
sh_size: BigInt(24),
|
|
253
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
name: '.plt',
|
|
257
|
-
sh_addr: BigInt(1072),
|
|
258
|
-
sh_addralign: BigInt(16),
|
|
259
|
-
sh_entsize: BigInt(0),
|
|
260
|
-
sh_flags: BigInt(6),
|
|
261
|
-
sh_info: 0,
|
|
262
|
-
sh_link: 0,
|
|
263
|
-
sh_name: 87,
|
|
264
|
-
sh_offset: BigInt(1072),
|
|
265
|
-
sh_size: BigInt(64),
|
|
266
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
name: '.text',
|
|
270
|
-
sh_addr: BigInt(1136),
|
|
271
|
-
sh_addralign: BigInt(16),
|
|
272
|
-
sh_entsize: BigInt(0),
|
|
273
|
-
sh_flags: BigInt(6),
|
|
274
|
-
sh_info: 0,
|
|
275
|
-
sh_link: 0,
|
|
276
|
-
sh_name: 98,
|
|
277
|
-
sh_offset: BigInt(1136),
|
|
278
|
-
sh_size: BigInt(236),
|
|
279
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
name: '.fini',
|
|
283
|
-
sh_addr: BigInt(1372),
|
|
284
|
-
sh_addralign: BigInt(4),
|
|
285
|
-
sh_entsize: BigInt(0),
|
|
286
|
-
sh_flags: BigInt(6),
|
|
287
|
-
sh_info: 0,
|
|
288
|
-
sh_link: 0,
|
|
289
|
-
sh_name: 104,
|
|
290
|
-
sh_offset: BigInt(1372),
|
|
291
|
-
sh_size: BigInt(20),
|
|
292
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: '.eh_frame_hdr',
|
|
296
|
-
sh_addr: BigInt(1392),
|
|
297
|
-
sh_addralign: BigInt(4),
|
|
298
|
-
sh_entsize: BigInt(0),
|
|
299
|
-
sh_flags: BigInt(2),
|
|
300
|
-
sh_info: 0,
|
|
301
|
-
sh_link: 0,
|
|
302
|
-
sh_name: 110,
|
|
303
|
-
sh_offset: BigInt(1392),
|
|
304
|
-
sh_size: BigInt(52),
|
|
305
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
name: '.eh_frame',
|
|
309
|
-
sh_addr: BigInt(1448),
|
|
310
|
-
sh_addralign: BigInt(8),
|
|
311
|
-
sh_entsize: BigInt(0),
|
|
312
|
-
sh_flags: BigInt(2),
|
|
313
|
-
sh_info: 0,
|
|
314
|
-
sh_link: 0,
|
|
315
|
-
sh_name: 124,
|
|
316
|
-
sh_offset: BigInt(1448),
|
|
317
|
-
sh_size: BigInt(144),
|
|
318
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: '.init_array',
|
|
322
|
-
sh_addr: BigInt(69168),
|
|
323
|
-
sh_addralign: BigInt(8),
|
|
324
|
-
sh_entsize: BigInt(8),
|
|
325
|
-
sh_flags: BigInt(3),
|
|
326
|
-
sh_info: 0,
|
|
327
|
-
sh_link: 0,
|
|
328
|
-
sh_name: 134,
|
|
329
|
-
sh_offset: BigInt(3632),
|
|
330
|
-
sh_size: BigInt(8),
|
|
331
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_INIT_ARRAY,
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
name: '.fini_array',
|
|
335
|
-
sh_addr: BigInt(69176),
|
|
336
|
-
sh_addralign: BigInt(8),
|
|
337
|
-
sh_entsize: BigInt(8),
|
|
338
|
-
sh_flags: BigInt(3),
|
|
339
|
-
sh_info: 0,
|
|
340
|
-
sh_link: 0,
|
|
341
|
-
sh_name: 146,
|
|
342
|
-
sh_offset: BigInt(3640),
|
|
343
|
-
sh_size: BigInt(8),
|
|
344
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_FINI_ARRAY,
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
name: '.dynamic',
|
|
348
|
-
sh_addr: BigInt(69184),
|
|
349
|
-
sh_addralign: BigInt(8),
|
|
350
|
-
sh_entsize: BigInt(16),
|
|
351
|
-
sh_flags: BigInt(3),
|
|
352
|
-
sh_info: 0,
|
|
353
|
-
sh_link: 4,
|
|
354
|
-
sh_name: 158,
|
|
355
|
-
sh_offset: BigInt(3648),
|
|
356
|
-
sh_size: BigInt(384),
|
|
357
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_DYNAMIC,
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
name: '.got',
|
|
361
|
-
sh_addr: BigInt(69568),
|
|
362
|
-
sh_addralign: BigInt(8),
|
|
363
|
-
sh_entsize: BigInt(8),
|
|
364
|
-
sh_flags: BigInt(3),
|
|
365
|
-
sh_info: 0,
|
|
366
|
-
sh_link: 0,
|
|
367
|
-
sh_name: 167,
|
|
368
|
-
sh_offset: BigInt(4032),
|
|
369
|
-
sh_size: BigInt(40),
|
|
370
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
name: '.got.plt',
|
|
374
|
-
sh_addr: BigInt(69608),
|
|
375
|
-
sh_addralign: BigInt(8),
|
|
376
|
-
sh_entsize: BigInt(8),
|
|
377
|
-
sh_flags: BigInt(3),
|
|
378
|
-
sh_info: 0,
|
|
379
|
-
sh_link: 0,
|
|
380
|
-
sh_name: 172,
|
|
381
|
-
sh_offset: BigInt(4072),
|
|
382
|
-
sh_size: BigInt(40),
|
|
383
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
name: '.data',
|
|
387
|
-
sh_addr: BigInt(69648),
|
|
388
|
-
sh_addralign: BigInt(8),
|
|
389
|
-
sh_entsize: BigInt(0),
|
|
390
|
-
sh_flags: BigInt(3),
|
|
391
|
-
sh_info: 0,
|
|
392
|
-
sh_link: 0,
|
|
393
|
-
sh_name: 181,
|
|
394
|
-
sh_offset: BigInt(4112),
|
|
395
|
-
sh_size: BigInt(8),
|
|
396
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
name: '.bss',
|
|
400
|
-
sh_addr: BigInt(69656),
|
|
401
|
-
sh_addralign: BigInt(1),
|
|
402
|
-
sh_entsize: BigInt(0),
|
|
403
|
-
sh_flags: BigInt(3),
|
|
404
|
-
sh_info: 0,
|
|
405
|
-
sh_link: 0,
|
|
406
|
-
sh_name: 187,
|
|
407
|
-
sh_offset: BigInt(4120),
|
|
408
|
-
sh_size: BigInt(8),
|
|
409
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_NOBITS,
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
name: '.comment',
|
|
413
|
-
sh_addr: BigInt(0),
|
|
414
|
-
sh_addralign: BigInt(1),
|
|
415
|
-
sh_entsize: BigInt(1),
|
|
416
|
-
sh_flags: BigInt(48),
|
|
417
|
-
sh_info: 0,
|
|
418
|
-
sh_link: 0,
|
|
419
|
-
sh_name: 192,
|
|
420
|
-
sh_offset: BigInt(4120),
|
|
421
|
-
sh_size: BigInt(43),
|
|
422
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
name: '.debug_aranges',
|
|
426
|
-
sh_addr: BigInt(0),
|
|
427
|
-
sh_addralign: BigInt(1),
|
|
428
|
-
sh_entsize: BigInt(0),
|
|
429
|
-
sh_flags: BigInt(0),
|
|
430
|
-
sh_info: 0,
|
|
431
|
-
sh_link: 0,
|
|
432
|
-
sh_name: 201,
|
|
433
|
-
sh_offset: BigInt(4163),
|
|
434
|
-
sh_size: BigInt(48),
|
|
435
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: '.debug_info',
|
|
439
|
-
sh_addr: BigInt(0),
|
|
440
|
-
sh_addralign: BigInt(1),
|
|
441
|
-
sh_entsize: BigInt(0),
|
|
442
|
-
sh_flags: BigInt(0),
|
|
443
|
-
sh_info: 0,
|
|
444
|
-
sh_link: 0,
|
|
445
|
-
sh_name: 216,
|
|
446
|
-
sh_offset: BigInt(4211),
|
|
447
|
-
sh_size: BigInt(84),
|
|
448
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
name: '.debug_abbrev',
|
|
452
|
-
sh_addr: BigInt(0),
|
|
453
|
-
sh_addralign: BigInt(1),
|
|
454
|
-
sh_entsize: BigInt(0),
|
|
455
|
-
sh_flags: BigInt(0),
|
|
456
|
-
sh_info: 0,
|
|
457
|
-
sh_link: 0,
|
|
458
|
-
sh_name: 228,
|
|
459
|
-
sh_offset: BigInt(4295),
|
|
460
|
-
sh_size: BigInt(56),
|
|
461
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
name: '.debug_line',
|
|
465
|
-
sh_addr: BigInt(0),
|
|
466
|
-
sh_addralign: BigInt(1),
|
|
467
|
-
sh_entsize: BigInt(0),
|
|
468
|
-
sh_flags: BigInt(0),
|
|
469
|
-
sh_info: 0,
|
|
470
|
-
sh_link: 0,
|
|
471
|
-
sh_name: 242,
|
|
472
|
-
sh_offset: BigInt(4351),
|
|
473
|
-
sh_size: BigInt(76),
|
|
474
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
name: '.debug_str',
|
|
478
|
-
sh_addr: BigInt(0),
|
|
479
|
-
sh_addralign: BigInt(1),
|
|
480
|
-
sh_entsize: BigInt(1),
|
|
481
|
-
sh_flags: BigInt(48),
|
|
482
|
-
sh_info: 0,
|
|
483
|
-
sh_link: 0,
|
|
484
|
-
sh_name: 254,
|
|
485
|
-
sh_offset: BigInt(4427),
|
|
486
|
-
sh_size: BigInt(135),
|
|
487
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
name: '.debug_line_str',
|
|
491
|
-
sh_addr: BigInt(0),
|
|
492
|
-
sh_addralign: BigInt(1),
|
|
493
|
-
sh_entsize: BigInt(1),
|
|
494
|
-
sh_flags: BigInt(48),
|
|
495
|
-
sh_info: 0,
|
|
496
|
-
sh_link: 0,
|
|
497
|
-
sh_name: 265,
|
|
498
|
-
sh_offset: BigInt(4562),
|
|
499
|
-
sh_size: BigInt(11),
|
|
500
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_PROGBITS,
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
name: '.symtab',
|
|
504
|
-
sh_addr: BigInt(0),
|
|
505
|
-
sh_addralign: BigInt(8),
|
|
506
|
-
sh_entsize: BigInt(24),
|
|
507
|
-
sh_flags: BigInt(0),
|
|
508
|
-
sh_info: 64,
|
|
509
|
-
sh_link: 28,
|
|
510
|
-
sh_name: 1,
|
|
511
|
-
sh_offset: BigInt(4576),
|
|
512
|
-
sh_size: BigInt(1656),
|
|
513
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_SYMTAB,
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
name: '.strtab',
|
|
517
|
-
sh_addr: BigInt(0),
|
|
518
|
-
sh_addralign: BigInt(1),
|
|
519
|
-
sh_entsize: BigInt(0),
|
|
520
|
-
sh_flags: BigInt(0),
|
|
521
|
-
sh_info: 0,
|
|
522
|
-
sh_link: 0,
|
|
523
|
-
sh_name: 9,
|
|
524
|
-
sh_offset: BigInt(6232),
|
|
525
|
-
sh_size: BigInt(378),
|
|
526
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_STRTAB,
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
name: '.shstrtab',
|
|
530
|
-
sh_addr: BigInt(0),
|
|
531
|
-
sh_addralign: BigInt(1),
|
|
532
|
-
sh_entsize: BigInt(0),
|
|
533
|
-
sh_flags: BigInt(0),
|
|
534
|
-
sh_info: 0,
|
|
535
|
-
sh_link: 0,
|
|
536
|
-
sh_name: 17,
|
|
537
|
-
sh_offset: BigInt(6610),
|
|
538
|
-
sh_size: BigInt(281),
|
|
539
|
-
sh_type: elf_constants_1.SectionHeaderType.SHT_STRTAB,
|
|
540
|
-
},
|
|
541
|
-
]);
|
|
542
|
-
}));
|
|
543
|
-
});
|
|
544
|
-
describe('readElfProgranHeaderTable', () => {
|
|
545
|
-
test('return program header table for ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
546
|
-
const reader = yield (0, elf_1.createReaderFromFile)(`${fixtureDir}/dyn_aarch64`);
|
|
547
|
-
const elfResult = yield (0, elf_1.readElfHeader)(reader);
|
|
548
|
-
const programHeaders = yield (0, elf_1.readElfProgramHeaderTable)(reader, elfResult.elfHeader);
|
|
549
|
-
expect(programHeaders).toEqual([
|
|
550
|
-
{
|
|
551
|
-
p_align: BigInt(65536),
|
|
552
|
-
p_filesz: BigInt(1592),
|
|
553
|
-
p_flags: 5,
|
|
554
|
-
p_memsz: BigInt(1592),
|
|
555
|
-
p_offset: BigInt(0),
|
|
556
|
-
p_paddr: BigInt(0),
|
|
557
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_LOAD,
|
|
558
|
-
p_vaddr: BigInt(0),
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
p_align: BigInt(65536),
|
|
562
|
-
p_filesz: BigInt(488),
|
|
563
|
-
p_flags: 6,
|
|
564
|
-
p_memsz: BigInt(496),
|
|
565
|
-
p_offset: BigInt(3632),
|
|
566
|
-
p_paddr: BigInt(69168),
|
|
567
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_LOAD,
|
|
568
|
-
p_vaddr: BigInt(69168),
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
p_align: BigInt(8),
|
|
572
|
-
p_filesz: BigInt(384),
|
|
573
|
-
p_flags: 6,
|
|
574
|
-
p_memsz: BigInt(384),
|
|
575
|
-
p_offset: BigInt(3648),
|
|
576
|
-
p_paddr: BigInt(69184),
|
|
577
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_DYNAMIC,
|
|
578
|
-
p_vaddr: BigInt(69184),
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
p_align: BigInt(4),
|
|
582
|
-
p_filesz: BigInt(36),
|
|
583
|
-
p_flags: 4,
|
|
584
|
-
p_memsz: BigInt(36),
|
|
585
|
-
p_offset: BigInt(456),
|
|
586
|
-
p_paddr: BigInt(456),
|
|
587
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_NOTE,
|
|
588
|
-
p_vaddr: BigInt(456),
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
p_align: BigInt(4),
|
|
592
|
-
p_filesz: BigInt(52),
|
|
593
|
-
p_flags: 4,
|
|
594
|
-
p_memsz: BigInt(52),
|
|
595
|
-
p_offset: BigInt(1392),
|
|
596
|
-
p_paddr: BigInt(1392),
|
|
597
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_GNU_EH_FRAME,
|
|
598
|
-
p_vaddr: BigInt(1392),
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
p_align: BigInt(16),
|
|
602
|
-
p_filesz: BigInt(0),
|
|
603
|
-
p_flags: 6,
|
|
604
|
-
p_memsz: BigInt(0),
|
|
605
|
-
p_offset: BigInt(0),
|
|
606
|
-
p_paddr: BigInt(0),
|
|
607
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_GNU_STACK,
|
|
608
|
-
p_vaddr: BigInt(0),
|
|
609
|
-
},
|
|
610
|
-
{
|
|
611
|
-
p_align: BigInt(1),
|
|
612
|
-
p_filesz: BigInt(464),
|
|
613
|
-
p_flags: 4,
|
|
614
|
-
p_memsz: BigInt(464),
|
|
615
|
-
p_offset: BigInt(3632),
|
|
616
|
-
p_paddr: BigInt(69168),
|
|
617
|
-
p_type: elf_constants_1.ProgramHeaderType.PT_GNU_RELRO,
|
|
618
|
-
p_vaddr: BigInt(69168),
|
|
619
|
-
},
|
|
620
|
-
]);
|
|
621
|
-
}));
|
|
622
|
-
});
|
|
623
|
-
describe('isSupportedArch', () => {
|
|
624
|
-
test('return true for supported arch', () => {
|
|
625
|
-
expect((0, elf_1.isSupportedArch)('aarch64')).toBeTruthy();
|
|
626
|
-
expect((0, elf_1.isSupportedArch)('x86_64')).toBeTruthy();
|
|
627
|
-
expect((0, elf_1.isSupportedArch)('arm')).toBeTruthy();
|
|
628
|
-
});
|
|
629
|
-
test('return false for unsupported arch', () => {
|
|
630
|
-
expect((0, elf_1.isSupportedArch)('sparc')).toBeFalsy();
|
|
631
|
-
});
|
|
632
|
-
});
|
|
633
|
-
describe('isSupportedElfType', () => {
|
|
634
|
-
test('return true for supported type', () => {
|
|
635
|
-
expect((0, elf_1.isSupportedElfType)('DYN')).toBeTruthy();
|
|
636
|
-
expect((0, elf_1.isSupportedElfType)('EXEC')).toBeTruthy();
|
|
637
|
-
});
|
|
638
|
-
test('return false for unsupported type', () => {
|
|
639
|
-
expect((0, elf_1.isSupportedElfType)('REL')).toBeFalsy();
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
describe('getBuildIds', () => {
|
|
643
|
-
test('return GNU build id from ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
644
|
-
const reader = yield (0, elf_1.createReaderFromFile)(`${fixtureDir}/dyn_aarch64`);
|
|
645
|
-
const { elfHeader } = yield (0, elf_1.readElfHeader)(reader);
|
|
646
|
-
const sectionHeaders = yield (0, elf_1.readElfSectionHeaderTable)(reader, elfHeader);
|
|
647
|
-
const { gnuBuildId, goBuildId } = yield (0, elf_1.getBuildIds)(reader, sectionHeaders, elfHeader);
|
|
648
|
-
expect(gnuBuildId).toEqual('90aef8b4a3cd45d758501e49d1d9844736c872cd');
|
|
649
|
-
expect(goBuildId).toBeFalsy();
|
|
650
|
-
}));
|
|
651
|
-
test('return Go build id from ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
652
|
-
const reader = yield (0, elf_1.createReaderFromFile)(`${fixtureDir}/go_x86_64_only_go_build_id`);
|
|
653
|
-
const { elfHeader } = yield (0, elf_1.readElfHeader)(reader);
|
|
654
|
-
const sectionHeaders = yield (0, elf_1.readElfSectionHeaderTable)(reader, elfHeader);
|
|
655
|
-
const { gnuBuildId, goBuildId } = yield (0, elf_1.getBuildIds)(reader, sectionHeaders, elfHeader);
|
|
656
|
-
expect(goBuildId).toEqual('tUhrGOwxi48kXlLhYlY3/WlmPekR2qonrFvofssLt/8beXJbt0rDaHhn3I6x8D/IA6Zd8Qc8Rsh_bFKoPVn');
|
|
657
|
-
expect(gnuBuildId).toBeFalsy();
|
|
658
|
-
}));
|
|
659
|
-
test('return Go and GNU build id from ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
660
|
-
const reader = yield (0, elf_1.createReaderFromFile)(`${fixtureDir}/go_x86_64_both_gnu_and_go_build_id`);
|
|
661
|
-
const { elfHeader } = yield (0, elf_1.readElfHeader)(reader);
|
|
662
|
-
const sectionHeaders = yield (0, elf_1.readElfSectionHeaderTable)(reader, elfHeader);
|
|
663
|
-
const { gnuBuildId, goBuildId } = yield (0, elf_1.getBuildIds)(reader, sectionHeaders, elfHeader);
|
|
664
|
-
expect(goBuildId).toEqual('tUhrGOwxi48kXlLhYlY3/WlmPekR2qonrFvofssLt/8beXJbt0rDaHhn3I6x8D/IA6Zd8Qc8Rsh_bFKoPVn');
|
|
665
|
-
expect(gnuBuildId).toEqual('6a5e565db576fe96acd8ab12bf857eb36f8afdf4');
|
|
666
|
-
}));
|
|
667
|
-
});
|
|
668
|
-
describe('computeFileHash', () => {
|
|
669
|
-
test('return hash of file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
670
|
-
const hash = yield (0, elf_1.computeFileHash)(`${fixtureDir}/exec_arm_big`);
|
|
671
|
-
expect(hash).toEqual('3c8e0a68a99a3a03836d225a33ac1f8d');
|
|
672
|
-
}));
|
|
673
|
-
test('return hash of small file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
674
|
-
const hash = yield (0, elf_1.computeFileHash)(`${fixtureDir}/truncated_elf_file`);
|
|
675
|
-
expect(hash).toEqual('9c4c18153f9b78e0885062b07e873259');
|
|
676
|
-
}));
|
|
677
|
-
});
|
|
678
|
-
describe('getElfFileMetadata', () => {
|
|
679
|
-
test('return error if file does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
680
|
-
const metadata = yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/non_existing_file`);
|
|
681
|
-
expect(metadata.error).toBeTruthy();
|
|
682
|
-
}));
|
|
683
|
-
test('return error if elf file is truncated', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
684
|
-
const metadata = yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/truncated_elf_file`);
|
|
685
|
-
expect(metadata.error).toBeTruthy();
|
|
686
|
-
}));
|
|
687
|
-
test('return metadata for ELF file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
688
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/dyn_aarch64`)).toEqual({
|
|
689
|
-
filename: `${fixtureDir}/dyn_aarch64`,
|
|
690
|
-
isElf: true,
|
|
691
|
-
littleEndian: true,
|
|
692
|
-
elfClass: 64,
|
|
693
|
-
arch: 'aarch64',
|
|
694
|
-
fileHash: '5ba2907faebb8002de89711d5f0f005c',
|
|
695
|
-
gnuBuildId: '90aef8b4a3cd45d758501e49d1d9844736c872cd',
|
|
696
|
-
goBuildId: '',
|
|
697
|
-
type: 'DYN',
|
|
698
|
-
hasDebugInfo: true,
|
|
699
|
-
hasSymbols: true,
|
|
700
|
-
hasCode: true,
|
|
701
|
-
});
|
|
702
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/.debug/dyn_aarch64.debug`)).toEqual({
|
|
703
|
-
filename: `${fixtureDir}/.debug/dyn_aarch64.debug`,
|
|
704
|
-
isElf: true,
|
|
705
|
-
littleEndian: true,
|
|
706
|
-
elfClass: 64,
|
|
707
|
-
arch: 'aarch64',
|
|
708
|
-
fileHash: '',
|
|
709
|
-
gnuBuildId: '90aef8b4a3cd45d758501e49d1d9844736c872cd',
|
|
710
|
-
goBuildId: '',
|
|
711
|
-
type: 'DYN',
|
|
712
|
-
hasDebugInfo: true,
|
|
713
|
-
hasSymbols: true,
|
|
714
|
-
hasCode: false,
|
|
715
|
-
});
|
|
716
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/dyn_aarch64_nobuildid`)).toEqual({
|
|
717
|
-
filename: `${fixtureDir}/dyn_aarch64_nobuildid`,
|
|
718
|
-
isElf: true,
|
|
719
|
-
littleEndian: true,
|
|
720
|
-
elfClass: 64,
|
|
721
|
-
arch: 'aarch64',
|
|
722
|
-
fileHash: 'b3af701d97f2e6872a05d2b6f67bf0cd',
|
|
723
|
-
gnuBuildId: '',
|
|
724
|
-
goBuildId: '',
|
|
725
|
-
type: 'DYN',
|
|
726
|
-
hasDebugInfo: true,
|
|
727
|
-
hasSymbols: true,
|
|
728
|
-
hasCode: true,
|
|
729
|
-
});
|
|
730
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/go_x86_64_both_gnu_and_go_build_id`)).toEqual({
|
|
731
|
-
filename: `${fixtureDir}/go_x86_64_both_gnu_and_go_build_id`,
|
|
732
|
-
isElf: true,
|
|
733
|
-
littleEndian: true,
|
|
734
|
-
elfClass: 64,
|
|
735
|
-
arch: 'x86_64',
|
|
736
|
-
gnuBuildId: '6a5e565db576fe96acd8ab12bf857eb36f8afdf4',
|
|
737
|
-
goBuildId: 'tUhrGOwxi48kXlLhYlY3/WlmPekR2qonrFvofssLt/8beXJbt0rDaHhn3I6x8D/IA6Zd8Qc8Rsh_bFKoPVn',
|
|
738
|
-
fileHash: '70c9cab66acf4f5c715119b0999c20a4',
|
|
739
|
-
type: 'DYN',
|
|
740
|
-
hasDebugInfo: false,
|
|
741
|
-
hasSymbols: false,
|
|
742
|
-
hasCode: true,
|
|
743
|
-
});
|
|
744
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/go_x86_64_only_go_build_id`)).toEqual({
|
|
745
|
-
filename: `${fixtureDir}/go_x86_64_only_go_build_id`,
|
|
746
|
-
isElf: true,
|
|
747
|
-
littleEndian: true,
|
|
748
|
-
elfClass: 64,
|
|
749
|
-
arch: 'x86_64',
|
|
750
|
-
gnuBuildId: '',
|
|
751
|
-
goBuildId: 'tUhrGOwxi48kXlLhYlY3/WlmPekR2qonrFvofssLt/8beXJbt0rDaHhn3I6x8D/IA6Zd8Qc8Rsh_bFKoPVn',
|
|
752
|
-
fileHash: '7d39634381df8bf0bb7101f36e78fea2',
|
|
753
|
-
type: 'DYN',
|
|
754
|
-
hasDebugInfo: false,
|
|
755
|
-
hasSymbols: false,
|
|
756
|
-
hasCode: true,
|
|
757
|
-
});
|
|
758
|
-
expect(yield (0, elf_1.getElfFileMetadata)(`${fixtureDir}/exec_arm_big`)).toEqual({
|
|
759
|
-
filename: `${fixtureDir}/exec_arm_big`,
|
|
760
|
-
isElf: true,
|
|
761
|
-
littleEndian: false,
|
|
762
|
-
elfClass: 32,
|
|
763
|
-
arch: 'arm',
|
|
764
|
-
gnuBuildId: '623209afd6c408f9009e57fad28782f056112daf',
|
|
765
|
-
goBuildId: '',
|
|
766
|
-
fileHash: '3c8e0a68a99a3a03836d225a33ac1f8d',
|
|
767
|
-
type: 'EXEC',
|
|
768
|
-
hasDebugInfo: true,
|
|
769
|
-
hasSymbols: true,
|
|
770
|
-
hasCode: true,
|
|
771
|
-
});
|
|
772
|
-
}));
|
|
773
|
-
});
|
|
774
|
-
describe('getOutputFilenameFromBuildId', () => {
|
|
775
|
-
test('return filename from build id', () => {
|
|
776
|
-
expect((0, elf_1.getOutputFilenameFromBuildId)('90aef8b4a3cd45d758501e49d1d9844736c872cd')).toEqual('90aef8b4a3cd45d758501e49d1d9844736c872cd');
|
|
777
|
-
expect((0, elf_1.getOutputFilenameFromBuildId)('tUhrGOwxi48kXlLhYlY3/WlmPekR2qonrFvofssLt/8beXJbt0rDaHhn3I6x8D/IA6Zd8Qc8Rsh_bFKoPVn')).toEqual('tUhrGOwxi48kXlLhYlY3-WlmPekR2qonrFvofssLt-8beXJbt0rDaHhn3I6x8D-IA6Zd8Qc8Rsh_bFKoPVn');
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
describe('copyElfDebugInfo', () => {
|
|
781
|
-
let tmpDirectory;
|
|
782
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
783
|
-
tmpDirectory = yield (0, utils_1.createUniqueTmpDirectory)();
|
|
784
|
-
}));
|
|
785
|
-
const checkCopyDebugInfo = (elfFile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
786
|
-
const filename = path_1.default.basename(elfFile);
|
|
787
|
-
const outputFilename = `${tmpDirectory}/${filename}.debug`;
|
|
788
|
-
const elfFileMetadata = yield (0, elf_1.getElfFileMetadata)(elfFile);
|
|
789
|
-
yield (0, elf_1.copyElfDebugInfo)(elfFile, outputFilename, elfFileMetadata, false);
|
|
790
|
-
const debugInfoMetadata = yield (0, elf_1.getElfFileMetadata)(outputFilename);
|
|
791
|
-
// check that elf and debug info metadata are equal except for hasCode and filename
|
|
792
|
-
expect(debugInfoMetadata).toEqual(Object.assign(Object.assign({}, elfFileMetadata), { hasCode: false, filename: outputFilename, fileHash: debugInfoMetadata.fileHash }));
|
|
793
|
-
});
|
|
794
|
-
test('copy debug info from elf files', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
795
|
-
const testFiles = [
|
|
796
|
-
'dyn_aarch64',
|
|
797
|
-
'exec_aarch64',
|
|
798
|
-
'.debug/dyn_aarch64.debug',
|
|
799
|
-
'go_x86_64_only_go_build_id',
|
|
800
|
-
'go_x86_64_only_go_build_id.debug',
|
|
801
|
-
'exec_arm_big',
|
|
802
|
-
'exec_arm_little',
|
|
803
|
-
];
|
|
804
|
-
for (const testFile of testFiles) {
|
|
805
|
-
yield checkCopyDebugInfo(`${fixtureDir}/${testFile}`);
|
|
806
|
-
}
|
|
807
|
-
}));
|
|
808
|
-
afterAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
809
|
-
yield (0, utils_1.deleteDirectory)(tmpDirectory);
|
|
810
|
-
}));
|
|
811
|
-
});
|
|
812
|
-
});
|
|
813
|
-
//# sourceMappingURL=elf.test.js.map
|