Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Fix firefox karma tests with support for extracting rules_webtesting archive files - #299

Closed
gregmagolan wants to merge 4 commits into
bazelbuild:masterfrom
gregmagolan:fix-firefox-karma-tests
Closed

gregmagolan wants to merge 4 commits into
bazelbuild:masterfrom
gregmagolan:fix-firefox-karma-tests

Conversation

@gregmagolan

@gregmagolan gregmagolan commented Oct 12, 2018 •

Copy link
Copy Markdown
Contributor

Resolves #296

Comment thread internal/karma/karma.conf.js Outdated
// We need to chmod the executable to executable since adm-zip doesn't handle that
fs.chmodSync(extractedExecutablePath, 755);
} else {
// If we're on OSX or Linux then we can use the provided rules_webtesting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do it with adm-zip always? why have two different modes if one of them is broken on windows

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was my original plan. however on Linux the archive is a tar.xz which adm-zip doesn't handle


// Helper function to find a particular namedFile
// within the webTestMetadata webTestFiles
function findNamedFile(webTestMetadata, key) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we could remove all the helper code for the extract_exe if we always unzip ourselves?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above: that was my original plan. however on Linux the archive is a tar.xz which adm-zip doesn't handle

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gregmagolan gregmagolan Oct 17, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. Using the provided EXTRACT_EXE is not ideal. I'll try those packages out.

@gregmagolan gregmagolan Oct 18, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this some more and looked at the npm packages. I think we'll run into trouble supporting the various compression formats in node. On Windows we can assume it will be a .zip file. On linux/OSX you may get .tar.bz2 (which is what it is currently actually and not tar.xz) or tar.gz or tar.xz in the future. If we stick to using EXTRACT_EXE then it ensures we can always extract on Linux and OSX:

if [[ "${BASENAME}" == *.deb ]]; then
  wrap dpkg -x "${ARCHIVE}" "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar ]]; then
  wrap tar xf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.bz2 || "${BASENAME}" == *.tbz2 ]]; then
  wrap tar xjf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.gz || "${BASENAME}" == *.tgz ]]; then
  wrap tar xzf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.Z ]]; then
  wrap tar xZf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.zip ]]; then
  wrap unzip "${ARCHIVE}" -d "${OUT_DIR}"
else
  >&2 printf "${ARCHIVE} is not a supported file type."
  exit -1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I think @DrMarcII might be interested, seems like EXTRACT EXE should be fixed in windows

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DrMarcII Ahhh. That's good to know. I didn't notice that. Can use EXTRACT_EXE on all platforms then 👍

@gregmagolan

Copy link
Copy Markdown
Contributor Author

@alexeagle Removed adm-zip :) Using EXTRACT_EXE on all platforms as since it is a .bat on Windows

Comment thread internal/karma/karma.conf.js Outdated
try {
// Paths are relative to the 'external' folder within runfiles
extractExe = extractExe ? path.join('external', extractExe) : extractExe;
archiveFile = path.join('external', archiveFile)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this going to work with the --nolegacy_external_runfiles flag?
I'll wait for that one to land before doing this one.
also missing a trailing semicolon :0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. I'll rebase to and let CI run on it,.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants