diff --git a/action.yml b/action.yml index 34060f5..c7a9e72 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,9 @@ inputs: openj9_repo: description: 'openj9 Repo' required: false + openj9-systemtestsRepo: + description: 'Personal openj9-systemtests Repo' + required: false tkg_Repo: description: 'Personal TKG Repo. For example, octocat/TKG:test' required: false diff --git a/dist/index.js b/dist/index.js index 4726fe1..002e24f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,121 +5,122 @@ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(689)); -const runaqa = __importStar(__nccwpck_require__(901)); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - const jdksource = core.getInput('jdksource', { required: false }); - const customizedSdkUrl = core.getInput('customizedSdkUrl', { - required: false - }); - let sdkdir = core.getInput('sdkdir', { required: false }); - const version = core.getInput('version', { required: false }); - const buildList = core.getInput('build_list', { required: false }); - const target = core.getInput('target', { required: false }); - const customTarget = core.getInput('custom_target', { required: false }); - const aqatestsRepo = core.getInput('aqa-testsRepo', { required: false }); - const aqasystemtestsRepo = core.getInput('aqa-systemtestRepo', { - required: false - }); - const openj9Repo = core.getInput('openj9_repo', { required: false }); - const tkgRepo = core.getInput('tkg_Repo', { required: false }); - const vendorTestRepos = core.getInput('vendor_testRepos', { required: false }); - const vendorTestBranches = core.getInput('vendor_testBranches', { - required: false - }); - const vendorTestDirs = core.getInput('vendor_testDirs', { required: false }); - const vendorTestShas = core.getInput('vendor_testShas', { required: false }); - const runParallel = core.getInput('run_parallel', { required: false }); - const numMachines = core.getInput('num_machines', { required: false }); - let vendorTestParams = ''; - // let arch = core.getInput("architecture", { required: false }) - if (jdksource !== 'upstream' && - jdksource !== 'github-hosted' && - jdksource !== 'install-jdk' && - jdksource !== 'nightly' && - jdksource !== 'customized') { - core.error(`jdksource should be one of [upstream, github-hosted, install-jdk, nightly, customized]. Found: ${jdksource}`); - } - if (buildList !== 'openjdk' && - !buildList.startsWith('external') && - !buildList.startsWith('functional') && - !buildList.startsWith('perf') && - !buildList.startsWith('system')) { - core.setFailed(`buildList should be one of or sub dir of [openjdk, external, functional, system, perf]. Found: ${buildList}`); - } - if ((jdksource === 'github-hosted' || jdksource === 'install-jdk') && - version.length === 0) { - core.setFailed('Please provide jdkversion if jdksource is github-hosted installed or AdoptOpenJDK/install-jdk installed.'); - } - if (vendorTestRepos !== '') { - vendorTestParams = `--vendor_repos ${vendorTestRepos}`; - } - if (vendorTestBranches !== '') { - vendorTestParams += ` --vendor_branches ${vendorTestBranches}`; - } - if (vendorTestDirs !== '') { - vendorTestParams += ` --vendor_dirs ${vendorTestDirs}`; - } - if (vendorTestShas !== '') { - vendorTestParams += ` --vendor_shas ${vendorTestShas}`; - } - if (sdkdir === '') { - sdkdir = process.cwd(); - } - if (runParallel === 'true' && numMachines != '1') { - yield runaqa.setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines); - } - else { - yield runaqa.runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo); - } - } - catch (error) { - if (error instanceof Error) { - core.setFailed(error.message); - } - else { - core.setFailed('Unexpected error'); - } - } - }); -} -run(); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const core = __importStar(__nccwpck_require__(689)); +const runaqa = __importStar(__nccwpck_require__(901)); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + const jdksource = core.getInput('jdksource', { required: false }); + const customizedSdkUrl = core.getInput('customizedSdkUrl', { + required: false + }); + let sdkdir = core.getInput('sdkdir', { required: false }); + const version = core.getInput('version', { required: false }); + const buildList = core.getInput('build_list', { required: false }); + const target = core.getInput('target', { required: false }); + const customTarget = core.getInput('custom_target', { required: false }); + const aqatestsRepo = core.getInput('aqa-testsRepo', { required: false }); + const aqasystemtestsRepo = core.getInput('aqa-systemtestRepo', { + required: false + }); + const openj9Repo = core.getInput('openj9_repo', { required: false }); + const openj9systemtestsRepo = core.getInput('openj9-systemtestsRepo', { required: false }); + const tkgRepo = core.getInput('tkg_Repo', { required: false }); + const vendorTestRepos = core.getInput('vendor_testRepos', { required: false }); + const vendorTestBranches = core.getInput('vendor_testBranches', { + required: false + }); + const vendorTestDirs = core.getInput('vendor_testDirs', { required: false }); + const vendorTestShas = core.getInput('vendor_testShas', { required: false }); + const runParallel = core.getInput('run_parallel', { required: false }); + const numMachines = core.getInput('num_machines', { required: false }); + let vendorTestParams = ''; + // let arch = core.getInput("architecture", { required: false }) + if (jdksource !== 'upstream' && + jdksource !== 'github-hosted' && + jdksource !== 'install-jdk' && + jdksource !== 'nightly' && + jdksource !== 'customized') { + core.error(`jdksource should be one of [upstream, github-hosted, install-jdk, nightly, customized]. Found: ${jdksource}`); + } + if (buildList !== 'openjdk' && + !buildList.startsWith('external') && + !buildList.startsWith('functional') && + !buildList.startsWith('perf') && + !buildList.startsWith('system')) { + core.setFailed(`buildList should be one of or sub dir of [openjdk, external, functional, system, perf]. Found: ${buildList}`); + } + if ((jdksource === 'github-hosted' || jdksource === 'install-jdk') && + version.length === 0) { + core.setFailed('Please provide jdkversion if jdksource is github-hosted installed or AdoptOpenJDK/install-jdk installed.'); + } + if (vendorTestRepos !== '') { + vendorTestParams = `--vendor_repos ${vendorTestRepos}`; + } + if (vendorTestBranches !== '') { + vendorTestParams += ` --vendor_branches ${vendorTestBranches}`; + } + if (vendorTestDirs !== '') { + vendorTestParams += ` --vendor_dirs ${vendorTestDirs}`; + } + if (vendorTestShas !== '') { + vendorTestParams += ` --vendor_shas ${vendorTestShas}`; + } + if (sdkdir === '') { + sdkdir = process.cwd(); + } + if (runParallel === 'true' && numMachines != '1') { + yield runaqa.setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo, numMachines); + } + else { + yield runaqa.runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo); + } + } + catch (error) { + if (error instanceof Error) { + core.setFailed(error.message); + } + else { + core.setFailed('Unexpected error'); + } + } + }); +} +run(); /***/ }), @@ -128,467 +129,475 @@ run(); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.setupParallelEnv = exports.runaqaTest = void 0; -const exec = __importStar(__nccwpck_require__(782)); -const core = __importStar(__nccwpck_require__(689)); -const io = __importStar(__nccwpck_require__(202)); -const tc = __importStar(__nccwpck_require__(818)); -const path = __importStar(__nccwpck_require__(17)); -const fs = __importStar(__nccwpck_require__(147)); -let tempDirectory = process.env['RUNNER_TEMP'] || ''; -const IS_WINDOWS = process.platform === 'win32'; -const IS_MACOS = process.platform === 'darwin'; -if (!tempDirectory) { - let baseLocation; - if (IS_WINDOWS) { - // On windows use the USERPROFILE env variable - baseLocation = process.env['USERPROFILE'] || 'C:\\'; - } - else if (IS_MACOS) { - baseLocation = '/Users'; - } - else { - baseLocation = '/home'; - } - tempDirectory = path.join(baseLocation, 'actions', 'temp'); -} -/** - * Runs aqa tests - * @param {string} version JDK Version being tested - * @param {string} jdksource Source for JDK - * @param {[string]} customizedSdkUrl Download link for JDK binaries - * @param {[string]} sdkdir Directory for SDK - * @param {[string]} buildList AQAvit Test suite - * @param {[string]} target aqa test(s) to run - * @param {[string]} customTarget custom test(s) to run - * @param {[string]} aqatestsRepo Alternative aqatestRepo - * @param {[string]} openj9Repo Alternative openj9Repo - * @param {[string]} tkgRepo Alternative TKG repo - * @param {[string]} vendorTestParams Vendor provided test parameters - * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo - * @return {[null]} null - */ -function runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo) { - return __awaiter(this, void 0, void 0, function* () { - yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo); - const options = {}; - let myOutput = ''; - options.listeners = { - stdout: (data) => { - myOutput += data.toString(); - } - }; - process.chdir('TKG'); - try { - yield exec.exec('make compile'); - if (target.includes('custom') && customTarget !== '') { - const customOption = `${target - .substr(1) - .toUpperCase()}_TARGET=${customTarget}`; - yield exec.exec('make', [`${target}`, `${customOption}`], options); - } - else if (target.includes('-f parallelList.mk')) { - yield exec.exec(`make ${target}`); - } - else { - yield exec.exec('make', [`${target}`], options); - } - } - catch (error) { - if (error instanceof Error) { - core.setFailed(error.message); - } - else { - core.setFailed('Unexpected error'); - } - } - if (myOutput.includes('FAILED test targets') === true) { - core.setFailed('There are failed tests'); - } - }); -} -exports.runaqaTest = runaqaTest; -/** - * Read job.properties and reset TEST_JDK_HOME env variable. - * @return {[null]} null - */ -function resetJDKHomeFromProperties() { - const jobProperties = `${process.env.GITHUB_WORKSPACE}/aqa-tests/job.properties`; - if (fs.existsSync(jobProperties)) { - const lines = fs - .readFileSync(jobProperties, 'utf-8') - .replace(/\r\n/g, '\n') - .split('\n') - .filter(Boolean); - for (const l of lines) { - const regexp = /TEST_JDK_HOME=(.*)/; - const match = regexp.exec(l); - if (match && match[1]) { - process.env.TEST_JDK_HOME = match[1]; - core.info(`Reset TEST_JDK_HOME to ${process.env.TEST_JDK_HOME}`); - } - } - } -} -/** - * Sets javaHome on the runner. Raise exception if not able to be set. - * @param {string} version JDK version - * @param {string} jdksource [description] - * @return {[string]} javaHome Java home - */ -function getTestJdkHome(version, jdksource) { - // Try JAVA_HOME first and then fall back to GITHUB actions default location - let javaHome = process.env[`JAVA_HOME_${version}_X64`]; - if (javaHome === undefined) { - javaHome = process.env['JAVA_HOME']; - } - if (jdksource === 'install-jdk') { - // work with AdoptOpenJDK/install-sdk - if (`JDK_${version}` in process.env) { - javaHome = process.env[`JDK_${version}`]; - } - else { - javaHome = process.env.JAVA_HOME; - } - } - // Remove spaces in Windows path and replace with a short name path, e.g. 'C:/Program Files/***' ->C:/Progra~1/*** - if (IS_WINDOWS && jdksource === 'github-hosted') { - javaHome = javaHome.replace(/Program Files/g, 'Progra~1'); - } - if (javaHome === undefined) { - // exit with error if JDK cannot be found - core.setFailed('JDK could not be found'); - } - return javaHome; -} -/** - * This function is an alternative of extra install step in workflow or alternative install action. This could also be implemented as github action - * @return {[null]} null - */ -function installPlatformDependencies() { - return __awaiter(this, void 0, void 0, function* () { - if (IS_WINDOWS) { - const cygwinPath = 'C:\\cygwin64'; - try { - if (!fs.existsSync(cygwinPath)) { - core.info(`if the cygwin exist?`); - yield io.mkdirP('C:\\cygwin64'); - yield io.mkdirP('C:\\cygwin_packages'); - yield tc.downloadTool('https://cygwin.com/setup-x86_64.exe', 'C:\\temp\\cygwin.exe'); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setupParallelEnv = exports.runaqaTest = void 0; +const exec = __importStar(__nccwpck_require__(782)); +const core = __importStar(__nccwpck_require__(689)); +const io = __importStar(__nccwpck_require__(202)); +const tc = __importStar(__nccwpck_require__(818)); +const path = __importStar(__nccwpck_require__(17)); +const fs = __importStar(__nccwpck_require__(147)); +let tempDirectory = process.env['RUNNER_TEMP'] || ''; +const IS_WINDOWS = process.platform === 'win32'; +const IS_MACOS = process.platform === 'darwin'; +if (!tempDirectory) { + let baseLocation; + if (IS_WINDOWS) { + // On windows use the USERPROFILE env variable + baseLocation = process.env['USERPROFILE'] || 'C:\\'; + } + else if (IS_MACOS) { + baseLocation = '/Users'; + } + else { + baseLocation = '/home'; + } + tempDirectory = path.join(baseLocation, 'actions', 'temp'); +} +/** + * Runs aqa tests + * @param {string} version JDK Version being tested + * @param {string} jdksource Source for JDK + * @param {[string]} customizedSdkUrl Download link for JDK binaries + * @param {[string]} sdkdir Directory for SDK + * @param {[string]} buildList AQAvit Test suite + * @param {[string]} target aqa test(s) to run + * @param {[string]} customTarget custom test(s) to run + * @param {[string]} aqatestsRepo Alternative aqatestRepo + * @param {[string]} openj9Repo Alternative openj9Repo + * @param {[string]} tkgRepo Alternative TKG repo + * @param {[string]} vendorTestParams Vendor provided test parameters + * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo + * @return {[null]} null + */ +function runaqaTest(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, customTarget, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo) { + return __awaiter(this, void 0, void 0, function* () { + yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo); + const options = {}; + let myOutput = ''; + options.listeners = { + stdout: (data) => { + myOutput += data.toString(); + } + }; + process.chdir('TKG'); + try { + yield exec.exec('make compile'); + if (target.includes('custom') && customTarget !== '') { + const customOption = `${target + .substr(1) + .toUpperCase()}_TARGET=${customTarget}`; + yield exec.exec('make', [`${target}`, `${customOption}`], options); + } + else if (target.includes('-f parallelList.mk')) { + yield exec.exec(`make ${target}`); + } + else { + yield exec.exec('make', [`${target}`], options); + } + } + catch (error) { + if (error instanceof Error) { + core.setFailed(error.message); + } + else { + core.setFailed('Unexpected error'); + } + } + if (myOutput.includes('FAILED test targets') === true) { + core.setFailed('There are failed tests'); + } + }); +} +exports.runaqaTest = runaqaTest; +/** + * Read job.properties and reset TEST_JDK_HOME env variable. + * @return {[null]} null + */ +function resetJDKHomeFromProperties() { + const jobProperties = `${process.env.GITHUB_WORKSPACE}/aqa-tests/job.properties`; + if (fs.existsSync(jobProperties)) { + const lines = fs + .readFileSync(jobProperties, 'utf-8') + .replace(/\r\n/g, '\n') + .split('\n') + .filter(Boolean); + for (const l of lines) { + const regexp = /TEST_JDK_HOME=(.*)/; + const match = regexp.exec(l); + if (match && match[1]) { + process.env.TEST_JDK_HOME = match[1]; + core.info(`Reset TEST_JDK_HOME to ${process.env.TEST_JDK_HOME}`); + } + } + } +} +/** + * Sets javaHome on the runner. Raise exception if not able to be set. + * @param {string} version JDK version + * @param {string} jdksource [description] + * @return {[string]} javaHome Java home + */ +function getTestJdkHome(version, jdksource) { + // Try JAVA_HOME first and then fall back to GITHUB actions default location + let javaHome = process.env[`JAVA_HOME_${version}_X64`]; + if (javaHome === undefined) { + javaHome = process.env['JAVA_HOME']; + } + if (jdksource === 'install-jdk') { + // work with AdoptOpenJDK/install-sdk + if (`JDK_${version}` in process.env) { + javaHome = process.env[`JDK_${version}`]; + } + else { + javaHome = process.env.JAVA_HOME; + } + } + // Remove spaces in Windows path and replace with a short name path, e.g. 'C:/Program Files/***' ->C:/Progra~1/*** + if (IS_WINDOWS && jdksource === 'github-hosted') { + javaHome = javaHome.replace(/Program Files/g, 'Progra~1'); + } + if (javaHome === undefined) { + // exit with error if JDK cannot be found + core.setFailed('JDK could not be found'); + } + return javaHome; +} +/** + * This function is an alternative of extra install step in workflow or alternative install action. This could also be implemented as github action + * @return {[null]} null + */ +function installPlatformDependencies() { + return __awaiter(this, void 0, void 0, function* () { + if (IS_WINDOWS) { + const cygwinPath = 'C:\\cygwin64'; + try { + if (!fs.existsSync(cygwinPath)) { + core.info(`if the cygwin exist?`); + yield io.mkdirP('C:\\cygwin64'); + yield io.mkdirP('C:\\cygwin_packages'); + yield tc.downloadTool('https://cygwin.com/setup-x86_64.exe', 'C:\\temp\\cygwin.exe'); yield exec.exec(`C:\\temp\\cygwin.exe --packages wget,bsdtar,rsync,gnupg,git,autoconf,make,gcc-core,mingw64-x86_64-gcc-core,unzip,zip,cpio,curl,grep,perl --quiet-mode --download --local-install --delete-orphans --site https://mirrors.kernel.org/sourceware/cygwin/ --local-package-dir "C:\\cygwin_packages" - --root "C:\\cygwin64"`); - yield exec.exec(`C:/cygwin64/bin/git config --system core.autocrlf false`); - core.addPath(`C:\\cygwin64\\bin`); - } - } - catch (error) { - if (error instanceof Error) { - core.warning(error.message); - } - else { - core.warning('Unexpected error'); - } - } - const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); - yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); - yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); - } - else if (IS_MACOS) { - yield exec.exec('brew install ant-contrib'); - yield exec.exec('sudo sysctl -w kern.sysv.shmall=655360'); - yield exec.exec('sudo sysctl -w kern.sysv.shmmax=125839605760'); - } - else { - if (fs.existsSync('/usr/bin/apt-get')) { - // Debian Based - yield exec.exec('sudo apt-get update'); - yield exec.exec('sudo apt-get install ant-contrib -y'); - } - else if (fs.existsSync('/usr/bin/yum')) { - // RPM Based - yield exec.exec('sudo yum update -y'); - yield exec.exec('sudo yum install p7zip -y'); - const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); - yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); - yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); - } - else if (fs.existsSync('/sbin/apk')) { - // Alpine Based - yield exec.exec('apk update'); - yield exec.exec('apk add p7zip'); - const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); - yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); - yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); - } - // environment - if ('RUNNER_USER' in process.env) { - process.env['LOGNAME'] = process.env['RUNNER_USER']; - } - else { - core.warning('RUNNER_USER is not the GitHub Actions environment variables shell script. Container is configured differently. Please check the updated lists of environment variables.'); - } - if (fs.existsSync('/usr/bin/apt-get')) { - // disable apport - yield exec.exec('sudo service apport stop'); - } - } - }); -} -/** - * set required SPEC env variable based on OS type. - * @return {[null]} null [description] - */ -function setSpec() { - if (IS_WINDOWS) { - process.env['SPEC'] = 'win_x86-64_cmprssptrs'; - } - else if (IS_MACOS) { - process.env['SPEC'] = 'osx_x86-64_cmprssptrs'; - } - else { - process.env['SPEC'] = 'linux_x86-64_cmprssptrs'; - } -} -/** - * Installs aqa-test repository onto the runner. - * @param {string} version JDK version - * @param {[string]} buildList [description] - * @param {[string]} aqatestsRepo Alternative aqatestRepo - * @return {[null]} null - */ -function getAqaTestsRepo(aqatestsRepo, version, buildList) { - return __awaiter(this, void 0, void 0, function* () { - let repoBranch = ['adoptium/aqa-tests', 'master']; - if (aqatestsRepo.length !== 0) { - repoBranch = parseRepoBranch(aqatestsRepo); - } - yield exec.exec(`git clone --depth 1 -b ${repoBranch[1]} https://github.com/${repoBranch[0]}.git`); - process.chdir('aqa-tests'); - // workaround until TKG can download the artifacts required for Windows - if (IS_WINDOWS && buildList != '') { - if (buildList === 'system') { - process.chdir('system'); - yield exec.exec(`git clone -q https://github.com/adoptium/aqa-systemtest.git`); // points to master - yield exec.exec(`git clone -q https://github.com/adoptium/STF.git`); // points to master - process.chdir('../'); - } - if (buildList === 'openjdk' && version != '') { - process.chdir('openjdk'); - // Shallow clone the adoptium JDK version - quietly - if there is a reference repo obtain objects from there - destination is openjdk-jdk - yield exec.exec(`git clone --depth 1 -q --reference-if-able ${process.env.GITHUB_WORKSPACE}/openjdk_cache https://github.com/adoptium/jdk${version}.git openjdk-jdk`); - process.chdir('../'); - } - } - }); -} -/** - * Sets the system test repo and branch env vars - * @param {[string]} aqasystemtestsRepo Repo containing aqa-systemtest project repo and branch - * @return {[null]} null - */ -function getAqaSystemTestsRepo(aqasystemtestsRepo) { - const repoBranch = parseRepoBranch(aqasystemtestsRepo); - process.env.ADOPTOPENJDK_SYSTEMTEST_REPO = repoBranch[0]; - process.env.ADOPTOPENJDK_SYSTEMTEST_BRANCH = repoBranch[1]; -} -/** - * Executes ./get.sh with any additional parameters supplied - * @param {string} jdksource [description] - * @param {[string]} customizedSdkUrl Download Link for JDK binaries - * @param {[string]} sdkdir Directory for SDK - * @param {[string]} openj9Repo Alternative openJ9repo - * @param {[string]} tkgRepo Alternative TKG - * @param {[string]} vendorTestParams Vendor supplied test parameters - * @return {[null]} null - */ -function runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir) { - return __awaiter(this, void 0, void 0, function* () { - let parameters = ''; - if (tkgRepo.length !== 0) { - const repoBranch = parseRepoBranch(tkgRepo); - parameters += `--tkg_branch ${repoBranch[1]} --tkg_repo https://github.com/${repoBranch[0]}.git`; - } - if (openj9Repo.length !== 0) { - const repoBranch = parseRepoBranch(openj9Repo); - parameters += ` --openj9_branch ${repoBranch[1]} --openj9_repo https://github.com/${repoBranch[0]}.git`; - } - if (jdksource.length !== 0) { - parameters += ` --sdk_resource ${jdksource}`; - } - if (customizedSdkUrl.length !== 0) { - parameters += ` --customizedURL ${customizedSdkUrl}`; - } - if (sdkdir.length !== 0) { - parameters += ` --sdkdir ${sdkdir}`; - } - if (IS_WINDOWS) { - yield exec.exec(`bash ./get.sh ${parameters} ${vendorTestParams}`); - } - else { - yield exec.exec(`./get.sh ${parameters} ${vendorTestParams}`); - } - }); -} -/** - * Sets up enviroment to generate parallelList.mk - * @param {string} version JDK Version being tested - * @param {string} jdksource Source for JDK - * @param {[string]} customizedSdkUrl Download link for JDK binaries - * @param {[string]} sdkdir Directory for SDK - * @param {[string]} buildList AQAvit Test suite - * @param {[string]} target test(s) to run - * @param {[string]} aqatestsRepo Alternative aqatestRepo - * @param {[string]} openj9Repo Alternative openj9Repo - * @param {[string]} tkgRepo Alternative TKG repo - * @param {[string]} vendorTestParams Vendor provided test parameters - * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo - * @return {[null]} null - */ -function setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, numMachines) { - return __awaiter(this, void 0, void 0, function* () { - yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo); - process.chdir('TKG'); - process.env.PARALLEL_OPTIONS = `PARALLEL_OPTIONS=TEST=${target} TEST_TIME= NUM_MACHINES=${numMachines}`; - yield exec.exec(`make genParallelList ${process.env.PARALLEL_OPTIONS}`); - }); -} -exports.setupParallelEnv = setupParallelEnv; -/** - * Sets required env variables. - * @param {string} version JDK Version being tested - * @param {string} jdksource Source for JDK - * @param {[string]} sdkdir Directory for SDK - * @param {[string]} buildList AQAvit Test suite - * @return {null} null - */ -function setupEnvVariables(version, jdksource, buildList, sdkdir) { - setSpec(); - process.env.BUILD_LIST = buildList; - if ((jdksource === 'upstream' || - jdksource === 'github-hosted' || - jdksource === 'install-jdk') && - !('TEST_JDK_HOME' in process.env)) { - process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource); - } - if (!('TEST_JDK_HOME' in process.env)) { - process.env.TEST_JDK_HOME = `${sdkdir}/openjdkbinary/j2sdk-image`; - } -} -/** - * Sets up the test environment on the runner. - * @param {string} version JDK Version being tested - * @param {string} jdksource Source for JDK - * @param {[string]} customizedSdkUrl Download link for JDK binaries - * @param {[string]} sdkdir Directory for SDK - * @param {[string]} buildList AQAvit Test suite - * @param {[string]} aqatestsRepo Alternative aqatestRepo - * @param {[string]} openj9Repo Alternative openj9Repo - * @param {[string]} tkgRepo Alternative TKG repo - * @param {[string]} vendorTestParams Vendor provided test parameters - * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo - * @return {null} null - */ -function setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo) { - return __awaiter(this, void 0, void 0, function* () { - yield installPlatformDependencies(); - setupEnvVariables(version, jdksource, buildList, sdkdir); - yield getAqaTestsRepo(aqatestsRepo, version, buildList); - yield runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir); - resetJDKHomeFromProperties(); - // parallelList must be in TKG - if (target.includes('-f parallelList.mk')) { - moveParallelListToTKG(); - } - // Get Dependencies, using /*zip*/dependents.zip to avoid loop every available files - let dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/test.getDependency/lastSuccessfulBuild/artifact//*zip*/dependents.zip'); - let sevenzexe = '7z'; - if (fs.existsSync('/usr/bin/yum')) { - sevenzexe = '7za'; - } - // Test.dependency only has one level of archive directory, none of actions toolkit support mv files by regex. Using 7zip discards the directory directly - yield exec.exec(`${sevenzexe} e -y ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`); - if (buildList.includes('system')) { - if (aqasystemtestsRepo && aqasystemtestsRepo.length !== 0) { - getAqaSystemTestsRepo(aqasystemtestsRepo); - } - dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/systemtest.getDependency/lastSuccessfulBuild/artifact/*zip*/dependents.zip'); - // System.dependency has different levels of archive structures archive/systemtest_prereqs/*.* - // None of io.mv, io.cp and exec.exec can mv directories as expected (mv archive/ ./). Move subfolder systemtest_prereqs instead. - const dependentPath = yield tc.extractZip(dependents, `${process.env.GITHUB_WORKSPACE}/`); - yield io.mv(`${dependentPath}/archive/systemtest_prereqs`, `${process.env.GITHUB_WORKSPACE}/aqa-tests`); - yield io.rmRF(`${dependentPath}/archive`); - } - }); -} -/** - * Moves the parallelList to TKG directory - * @return {null} null - */ -function moveParallelListToTKG() { - return __awaiter(this, void 0, void 0, function* () { - if (IS_WINDOWS) { - yield io.cp(`${process.env.GITHUB_WORKSPACE}\\parallelList.mk`, `${process.env.GITHUB_WORKSPACE}\\aqa-tests\\TKG\\parallelList.mk`); - } - else { - yield io.cp(`${process.env.GITHUB_WORKSPACE}/parallelList.mk`, `${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/parallelList.mk`); - } - }); -} -/** - * Splits the repo branch to obtain project name - * @param {[string]} repoBranch repository branch to split upon - * @return {[string[]]} Array containing parsed string or error message. - */ -function parseRepoBranch(repoBranch) { - const tempRepo = repoBranch.replace(/\s/g, ''); - const slashIndexCheck = tempRepo.indexOf('/'); - const colonIndexCheck = tempRepo.indexOf(':'); - if (slashIndexCheck > 0 && - colonIndexCheck > 0 && - slashIndexCheck < colonIndexCheck) { - return tempRepo.split(':'); - } - else { - core.warning("Error in string parameter format. Required form: 'octocat/projectname:branch' "); - return []; - } -} + --root "C:\\cygwin64"`); + yield exec.exec(`C:/cygwin64/bin/git config --system core.autocrlf false`); + core.addPath(`C:\\cygwin64\\bin`); + } + } + catch (error) { + if (error instanceof Error) { + core.warning(error.message); + } + else { + core.warning('Unexpected error'); + } + } + const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); + yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); + yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); + } + else if (IS_MACOS) { + yield exec.exec('brew install ant-contrib'); + yield exec.exec('sudo sysctl -w kern.sysv.shmall=655360'); + yield exec.exec('sudo sysctl -w kern.sysv.shmmax=125839605760'); + } + else { + if (fs.existsSync('/usr/bin/apt-get')) { + // Debian Based + yield exec.exec('sudo apt-get update'); + yield exec.exec('sudo apt-get install ant-contrib -y'); + } + else if (fs.existsSync('/usr/bin/yum')) { + // RPM Based + yield exec.exec('sudo yum update -y'); + yield exec.exec('sudo yum install p7zip -y'); + const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); + yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); + yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); + } + else if (fs.existsSync('/sbin/apk')) { + // Alpine Based + yield exec.exec('apk update'); + yield exec.exec('apk add p7zip'); + const antContribFile = yield tc.downloadTool(`https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip/download`); + yield tc.extractZip(`${antContribFile}`, `${tempDirectory}`); + yield io.cp(`${tempDirectory}/ant-contrib/lib/ant-contrib.jar`, `${process.env.ANT_HOME}\\lib`); + } + // environment + if ('RUNNER_USER' in process.env) { + process.env['LOGNAME'] = process.env['RUNNER_USER']; + } + else { + core.warning('RUNNER_USER is not the GitHub Actions environment variables shell script. Container is configured differently. Please check the updated lists of environment variables.'); + } + if (fs.existsSync('/usr/bin/apt-get')) { + // disable apport + yield exec.exec('sudo service apport stop'); + } + } + }); +} +/** + * set required SPEC env variable based on OS type. + * @return {[null]} null [description] + */ +function setSpec() { + if (IS_WINDOWS) { + process.env['SPEC'] = 'win_x86-64_cmprssptrs'; + } + else if (IS_MACOS) { + process.env['SPEC'] = 'osx_x86-64_cmprssptrs'; + } + else { + process.env['SPEC'] = 'linux_x86-64_cmprssptrs'; + } +} +/** + * Installs aqa-test repository onto the runner. + * @param {string} version JDK version + * @param {[string]} buildList [description] + * @param {[string]} aqatestsRepo Alternative aqatestRepo + * @return {[null]} null + */ +function getAqaTestsRepo(aqatestsRepo, version, buildList) { + return __awaiter(this, void 0, void 0, function* () { + let repoBranch = ['adoptium/aqa-tests', 'master']; + if (aqatestsRepo.length !== 0) { + repoBranch = parseRepoBranch(aqatestsRepo); + } + yield exec.exec(`git clone --depth 1 -b ${repoBranch[1]} https://github.com/${repoBranch[0]}.git`); + process.chdir('aqa-tests'); + // workaround until TKG can download the artifacts required for Windows + if (IS_WINDOWS && buildList != '') { + if (buildList === 'system') { + process.chdir('system'); + yield exec.exec(`git clone -q https://github.com/adoptium/aqa-systemtest.git`); // points to master + yield exec.exec(`git clone -q https://github.com/adoptium/STF.git`); // points to master + process.chdir('../'); + } + if (buildList === 'openjdk' && version != '') { + process.chdir('openjdk'); + // Shallow clone the adoptium JDK version - quietly - if there is a reference repo obtain objects from there - destination is openjdk-jdk + yield exec.exec(`git clone --depth 1 -q --reference-if-able ${process.env.GITHUB_WORKSPACE}/openjdk_cache https://github.com/adoptium/jdk${version}.git openjdk-jdk`); + process.chdir('../'); + } + } + }); +} +/** + * Sets the system test repo and branch env vars + * @param {[string]} aqasystemtestsRepo Repo containing aqa-systemtest project repo and branch + * @return {[null]} null + */ +function getAqaSystemTestsRepo(aqasystemtestsRepo) { + const repoBranch = parseRepoBranch(aqasystemtestsRepo); + process.env.ADOPTOPENJDK_SYSTEMTEST_REPO = repoBranch[0]; + process.env.ADOPTOPENJDK_SYSTEMTEST_BRANCH = repoBranch[1]; +} +function getOpenj9SystemTestsRepo(openj9systemtestsRepo) { + const repoBranch = parseRepoBranch(openj9systemtestsRepo); + process.env.ADOPTOPENJDK_SYSTEMTEST_REPO = repoBranch[0]; + process.env.ADOPTOPENJDK_SYSTEMTEST_BRANCH = repoBranch[1]; +} +/** + * Executes ./get.sh with any additional parameters supplied + * @param {string} jdksource [description] + * @param {[string]} customizedSdkUrl Download Link for JDK binaries + * @param {[string]} sdkdir Directory for SDK + * @param {[string]} openj9Repo Alternative openJ9repo + * @param {[string]} tkgRepo Alternative TKG + * @param {[string]} vendorTestParams Vendor supplied test parameters + * @return {[null]} null + */ +function runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir) { + return __awaiter(this, void 0, void 0, function* () { + let parameters = ''; + if (tkgRepo.length !== 0) { + const repoBranch = parseRepoBranch(tkgRepo); + parameters += `--tkg_branch ${repoBranch[1]} --tkg_repo https://github.com/${repoBranch[0]}.git`; + } + if (openj9Repo.length !== 0) { + const repoBranch = parseRepoBranch(openj9Repo); + parameters += ` --openj9_branch ${repoBranch[1]} --openj9_repo https://github.com/${repoBranch[0]}.git`; + } + if (jdksource.length !== 0) { + parameters += ` --sdk_resource ${jdksource}`; + } + if (customizedSdkUrl.length !== 0) { + parameters += ` --customizedURL ${customizedSdkUrl}`; + } + if (sdkdir.length !== 0) { + parameters += ` --sdkdir ${sdkdir}`; + } + if (IS_WINDOWS) { + yield exec.exec(`bash ./get.sh ${parameters} ${vendorTestParams}`); + } + else { + yield exec.exec(`./get.sh ${parameters} ${vendorTestParams}`); + } + }); +} +/** + * Sets up enviroment to generate parallelList.mk + * @param {string} version JDK Version being tested + * @param {string} jdksource Source for JDK + * @param {[string]} customizedSdkUrl Download link for JDK binaries + * @param {[string]} sdkdir Directory for SDK + * @param {[string]} buildList AQAvit Test suite + * @param {[string]} target test(s) to run + * @param {[string]} aqatestsRepo Alternative aqatestRepo + * @param {[string]} openj9Repo Alternative openj9Repo + * @param {[string]} tkgRepo Alternative TKG repo + * @param {[string]} vendorTestParams Vendor provided test parameters + * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo + * @return {[null]} null + */ +function setupParallelEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo, numMachines) { + return __awaiter(this, void 0, void 0, function* () { + yield setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo); + process.chdir('TKG'); + process.env.PARALLEL_OPTIONS = `PARALLEL_OPTIONS=TEST=${target} TEST_TIME= NUM_MACHINES=${numMachines}`; + yield exec.exec(`make genParallelList ${process.env.PARALLEL_OPTIONS}`); + }); +} +exports.setupParallelEnv = setupParallelEnv; +/** + * Sets required env variables. + * @param {string} version JDK Version being tested + * @param {string} jdksource Source for JDK + * @param {[string]} sdkdir Directory for SDK + * @param {[string]} buildList AQAvit Test suite + * @return {null} null + */ +function setupEnvVariables(version, jdksource, buildList, sdkdir) { + setSpec(); + process.env.BUILD_LIST = buildList; + if ((jdksource === 'upstream' || + jdksource === 'github-hosted' || + jdksource === 'install-jdk') && + !('TEST_JDK_HOME' in process.env)) { + process.env.TEST_JDK_HOME = getTestJdkHome(version, jdksource); + } + if (!('TEST_JDK_HOME' in process.env)) { + process.env.TEST_JDK_HOME = `${sdkdir}/openjdkbinary/j2sdk-image`; + } +} +/** + * Sets up the test environment on the runner. + * @param {string} version JDK Version being tested + * @param {string} jdksource Source for JDK + * @param {[string]} customizedSdkUrl Download link for JDK binaries + * @param {[string]} sdkdir Directory for SDK + * @param {[string]} buildList AQAvit Test suite + * @param {[string]} aqatestsRepo Alternative aqatestRepo + * @param {[string]} openj9Repo Alternative openj9Repo + * @param {[string]} tkgRepo Alternative TKG repo + * @param {[string]} vendorTestParams Vendor provided test parameters + * @param {[string]} aqasystemtestsRepo Alternative AQA-systemtestRepo + * @return {null} null + */ +function setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo, openj9systemtestsRepo) { + return __awaiter(this, void 0, void 0, function* () { + yield installPlatformDependencies(); + setupEnvVariables(version, jdksource, buildList, sdkdir); + yield getAqaTestsRepo(aqatestsRepo, version, buildList); + yield runGetSh(tkgRepo, openj9Repo, vendorTestParams, jdksource, customizedSdkUrl, sdkdir); + resetJDKHomeFromProperties(); + // parallelList must be in TKG + if (target.includes('-f parallelList.mk')) { + moveParallelListToTKG(); + } + // Get Dependencies, using /*zip*/dependents.zip to avoid loop every available files + let dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/test.getDependency/lastSuccessfulBuild/artifact//*zip*/dependents.zip'); + let sevenzexe = '7z'; + if (fs.existsSync('/usr/bin/yum')) { + sevenzexe = '7za'; + } + // Test.dependency only has one level of archive directory, none of actions toolkit support mv files by regex. Using 7zip discards the directory directly + yield exec.exec(`${sevenzexe} e -y ${dependents} -o${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/lib`); + if (buildList.includes('system')) { + if (aqasystemtestsRepo && aqasystemtestsRepo.length !== 0) { + getAqaSystemTestsRepo(aqasystemtestsRepo); + } + if (openj9systemtestsRepo && openj9systemtestsRepo.length !== 0) { + getOpenj9SystemTestsRepo(openj9systemtestsRepo); + } + dependents = yield tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/systemtest.getDependency/lastSuccessfulBuild/artifact/*zip*/dependents.zip'); + // System.dependency has different levels of archive structures archive/systemtest_prereqs/*.* + // None of io.mv, io.cp and exec.exec can mv directories as expected (mv archive/ ./). Move subfolder systemtest_prereqs instead. + const dependentPath = yield tc.extractZip(dependents, `${process.env.GITHUB_WORKSPACE}/`); + yield io.mv(`${dependentPath}/archive/systemtest_prereqs`, `${process.env.GITHUB_WORKSPACE}/aqa-tests`); + yield io.rmRF(`${dependentPath}/archive`); + } + }); +} +/** + * Moves the parallelList to TKG directory + * @return {null} null + */ +function moveParallelListToTKG() { + return __awaiter(this, void 0, void 0, function* () { + if (IS_WINDOWS) { + yield io.cp(`${process.env.GITHUB_WORKSPACE}\\parallelList.mk`, `${process.env.GITHUB_WORKSPACE}\\aqa-tests\\TKG\\parallelList.mk`); + } + else { + yield io.cp(`${process.env.GITHUB_WORKSPACE}/parallelList.mk`, `${process.env.GITHUB_WORKSPACE}/aqa-tests/TKG/parallelList.mk`); + } + }); +} +/** + * Splits the repo branch to obtain project name + * @param {[string]} repoBranch repository branch to split upon + * @return {[string[]]} Array containing parsed string or error message. + */ +function parseRepoBranch(repoBranch) { + const tempRepo = repoBranch.replace(/\s/g, ''); + const slashIndexCheck = tempRepo.indexOf('/'); + const colonIndexCheck = tempRepo.indexOf(':'); + if (slashIndexCheck > 0 && + colonIndexCheck > 0 && + slashIndexCheck < colonIndexCheck) { + return tempRepo.split(':'); + } + else { + core.warning("Error in string parameter format. Required form: 'octocat/projectname:branch' "); + return []; + } +} /***/ }), diff --git a/src/aqa.ts b/src/aqa.ts index 040e40d..18d64d0 100644 --- a/src/aqa.ts +++ b/src/aqa.ts @@ -17,6 +17,7 @@ async function run(): Promise { required: false }) const openj9Repo = core.getInput('openj9_repo', {required: false}) + const openj9systemtestsRepo = core.getInput('openj9-systemtestsRepo', { required: false }); const tkgRepo = core.getInput('tkg_Repo', {required: false}) const vendorTestRepos = core.getInput('vendor_testRepos', {required: false}) const vendorTestBranches = core.getInput('vendor_testBranches', { @@ -88,6 +89,7 @@ async function run(): Promise { tkgRepo, vendorTestParams, aqasystemtestsRepo, + openj9systemtestsRepo, numMachines ) } @@ -104,7 +106,8 @@ async function run(): Promise { openj9Repo, tkgRepo, vendorTestParams, - aqasystemtestsRepo + aqasystemtestsRepo, + openj9systemtestsRepo ) } } catch (error) { diff --git a/src/runaqa.ts b/src/runaqa.ts index 464241f..cae4904 100644 --- a/src/runaqa.ts +++ b/src/runaqa.ts @@ -50,6 +50,7 @@ export async function runaqaTest( customTarget: string, aqatestsRepo: string, openj9Repo: string, + openj9systemtestsRepo: string, tkgRepo: string, vendorTestParams: string, aqasystemtestsRepo: string @@ -64,6 +65,7 @@ export async function runaqaTest( target, aqatestsRepo, openj9Repo, + openj9systemtestsRepo, tkgRepo, vendorTestParams, aqasystemtestsRepo @@ -306,6 +308,12 @@ function getAqaSystemTestsRepo(aqasystemtestsRepo: string): void { process.env.ADOPTOPENJDK_SYSTEMTEST_REPO = repoBranch[0] process.env.ADOPTOPENJDK_SYSTEMTEST_BRANCH = repoBranch[1] } +function getOpenj9SystemTestsRepo(openj9systemtestsRepo: string): void { + const repoBranch = parseRepoBranch(openj9systemtestsRepo); + process.env.ADOPTOPENJDK_SYSTEMTEST_REPO = repoBranch[0]; + process.env.ADOPTOPENJDK_SYSTEMTEST_BRANCH = repoBranch[1]; +} + /** * Executes ./get.sh with any additional parameters supplied @@ -377,10 +385,11 @@ export async function setupParallelEnv( tkgRepo: string, vendorTestParams: string, aqasystemtestsRepo: string, + openj9systemtestsRepo: string, numMachines: string ): Promise { - await setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, tkgRepo, vendorTestParams, aqasystemtestsRepo); + await setupTestEnv(version, jdksource, customizedSdkUrl, sdkdir, buildList, target, aqatestsRepo, openj9Repo, openj9systemtestsRepo, tkgRepo, vendorTestParams, aqasystemtestsRepo); process.chdir('TKG'); process.env.PARALLEL_OPTIONS = `PARALLEL_OPTIONS=TEST=${target} TEST_TIME= NUM_MACHINES=${numMachines}`; await exec.exec(`make genParallelList ${process.env.PARALLEL_OPTIONS}`); @@ -432,6 +441,7 @@ async function setupTestEnv( target: string, aqatestsRepo: string, openj9Repo: string, + openj9systemtestsRepo: string, tkgRepo: string, vendorTestParams: string, aqasystemtestsRepo: string @@ -460,6 +470,9 @@ async function setupTestEnv( if (aqasystemtestsRepo && aqasystemtestsRepo.length !== 0) { getAqaSystemTestsRepo(aqasystemtestsRepo); } + if (openj9systemtestsRepo && openj9systemtestsRepo.length !== 0) { + getOpenj9SystemTestsRepo(openj9systemtestsRepo); + } dependents = await tc.downloadTool('https://ci.adoptopenjdk.net/view/all/job/systemtest.getDependency/lastSuccessfulBuild/artifact/*zip*/dependents.zip'); // System.dependency has different levels of archive structures archive/systemtest_prereqs/*.* // None of io.mv, io.cp and exec.exec can mv directories as expected (mv archive/ ./). Move subfolder systemtest_prereqs instead.