Skip to content

Write tests for rust_install::component #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 30, 2016
Merged

Write tests for rust_install::component #45

merged 15 commits into from
Jan 30, 2016

Conversation

brson
Copy link
Contributor

@brson brson commented Jan 26, 2016

Basic tests for installation and uninstallation.

Fixed some bugs. Added validation of package installer versions.
Added validation of installed metadata format, bringing it closer
inline with what rust-installer produces. Added permission setting
on unix.

Tabs vs. spaces is screwy here. I'll submit a follow up that rustfmts master, merges master back into new, and rustfmts new.

I'm planning on writing tests for file system transactions next, then investigating the manifest code.

It's possible this branch will start diverging a lot from the master branch soon, and it'll get harder to keep them in sync. I'm not sure yet whether it's best to try to maintain continuity with the v1 manifest world, or consider this a new product and jettison the legacy stuff.

jwilm and others added 3 commits January 11, 2016 08:28
std::thread::sleep_ms has been deprecated in favor of std::thread::sleep
with a std::time::Duration being passed as the argument. This updates
all usage in this project of sleep_ms with sleep.
Fix deprecation warnings for sleep_ms
Basic tests for installation and uninstallation.

Fixed some bugs. Added validation of package installer versions.
Added validation of installed metadata format, bringing it closer
inline with what rust-installer produces. Added permission setting
on unix.
@alexcrichton
Copy link
Member

You may want to make sure that these are running on both appveyor/travis, I think the top-level Cargo tests are being run but perhaps not the rust-install ones?

It also may make sense to start out these tests as integration tests in tests/ as they require lots of filesystem interaction, but that's just a stylistic choice on your behalf really

}
pub fn init(prefix: InstallPrefix) -> Result<Self> {
try!(utils::write_file("components", &prefix.manifest_file(COMPONENTS_FILE), ""));
Ok(Components { prefix: prefix })
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why init was removed? The new -> open and Option -> Result changes make sense, although the other "InstallPrefix wrappers" for lack of a better term should probably be refactored in the same way (Configuration and Manifestation). init was required for initializing an fresh install.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, I thought I left a comment about this. It's because initializing the components file before any components are written, and outside of a transaction, could leave the installation in a partial state where nothing is installed but there is a rustlib/components file. Both 'components' and 'rust-installer-version' are initialized inside the transaction that installs the first component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't change Configuration and manifestation because I haven't started learning that code yet, but I can also change them today.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem - it was meant more as a note that we'll have to do it than as a criticism of the PR!

@brson
Copy link
Contributor Author

brson commented Jan 27, 2016

Thanks for the review @Diggsey

@brson
Copy link
Contributor Author

brson commented Jan 28, 2016

Here's the rustfmt PR against master. I've updated this PR to move the tests to the tests directory and run rustfmt over it. I'm going to continue writing tests for the transaction code now and will keep appending commits to this PR, then I will move on to learning the manifest code.

@Diggsey
Copy link
Contributor

Diggsey commented Jan 28, 2016

Incredible progress! I think @alexcrichton is right though: none of the rust_install tests seem to be running on travis.

brson and others added 5 commits January 28, 2016 12:49
Run rustfmt over everything
Conflicts:
	rust-install/src/errors.rs
	rust-install/src/install.rs
	rust-install/src/notify.rs
	rust-install/src/utils/mod.rs
	rust-install/src/utils/raw.rs
@brson
Copy link
Contributor Author

brson commented Jan 29, 2016

Hm, the history on this PR looks weird with some other folks commits. I must have merged something wrong.

Edit: the extra commits are because this PR is against branch 'new' and I merged from 'master'.

@brson
Copy link
Contributor Author

brson commented Jan 29, 2016

Uh oh. rustfmting everything made the combined diff useless...

@brson
Copy link
Contributor Author

brson commented Jan 29, 2016

OK, I've addressed all the feedback. I'm not going to push more work to this branch because of the big diff already.

The appveyor build is having trouble linking openssl. Here are some of the errors:

libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_ndef.obj) : warning LNK4099: PDB 'libMT.pdb' was not found with 'libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_ndef.obj)' or at 'C:\projects\multirust-rs\target\debug\libMT.pdb'; linking object as if no debug info
libopenssl_sys-26ea9bf6206dbf1a.rlib(asn_mime.obj) : warning LNK4099: PDB 'libMT.pdb' was not found with 'libopenssl_sys-26ea9bf6206dbf1a.rlib(asn_mime.obj)' or at 'C:\projects\multirust-rs\target\debug\libMT.pdb'; linking object as if no debug info
libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_asn1.obj) : warning LNK4099: PDB 'libMT.pdb' was not found with 'libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_asn1.obj)' or at 'C:\projects\multirust-rs\target\debug\libMT.pdb'; linking object as if no debug info
libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_b64.obj) : warning LNK4099: PDB 'libMT.pdb' was not found with 'libopenssl_sys-26ea9bf6206dbf1a.rlib(bio_b64.obj)' or at 'C:\projects\multirust-rs\target\debug\libMT.pdb'; linking object as if no debug info
libopenssl_sys-26ea9bf6206dbf1a.rlib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetUserObjectInformationW referenced in function OPENSSL_isservice
libopenssl_sys-26ea9bf6206dbf1a.rlib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxW referenced in function OPENSSL_showfatal
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_CreateCompatibleBitmap referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_DeleteObject referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDeviceCaps referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDIBits referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetObjectW referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDC referenced in function readscreen
libopenssl_sys-26ea9bf6206dbf1a.rlib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_ReleaseDC referenced in function readscreen
C:\projects\multirust-rs\target\debug\deps\libshell32-d4cbd87c7e8d7b84.rlib : fatal error LNK1107: invalid or corrupt file: cannot read at 0x3120

error: aborting due to previous error
Could not compile `multirust-rs`. 

It's using openssl from http://www.npcglib.org/~stathis/downloads/openssl-1.0.2d-vs2015.7z

@alexcrichton
Copy link
Member

I think that may have to do with some of the old support in appveyor.yml. I believe this can now be fixed by emitting a .cargo/config that looks like:

[target.x86_64-pc-windows-msvc.openssl]
rustc-link-search = ['C:\OpenSSL\openssl-1.0.2d-vs2015\lib64']
rustc-link-libs = ['static=ssleay32MT', 'static=libeay32MT']
include = ['C:\OpenSSL\openssl-1.0.2d-vs2015\include']

[target.i686-pc-windows-msvc.openssl]
rustc-link-search = ['C:\OpenSSL\openssl-1.0.2d-vs2015\lib']
rustc-link-libs = ['static=ssleay32MT', 'static=libeay32MT']
include = ['C:\OpenSSL\openssl-1.0.2d-vs2015\include']

# ... etc

I think the GNU triples may also need some things there as well. Basically to statically link OpenSSL on Windows I think you'll want to use .cargo/config to override openssl-sys's build script

@alexcrichton
Copy link
Member

I've opened a PR, but it looks like the cli.bat script still has some errors

Fix linkage errors on appveyor
@brson
Copy link
Contributor Author

brson commented Jan 30, 2016

Thanks alex.

@brson
Copy link
Contributor Author

brson commented Jan 30, 2016

OK, I tried to fix appveyor by adding cargo build --release as a test step so that the multirust bin ends up in the right place. If that's ok then this is good to go.

Diggsey added a commit that referenced this pull request Jan 30, 2016
Write tests for rust_install::component
@Diggsey Diggsey merged commit 2d3e3f9 into rust-lang:new Jan 30, 2016
@Diggsey
Copy link
Contributor

Diggsey commented Jan 30, 2016

\o/

@brson
Copy link
Contributor Author

brson commented Jan 30, 2016

Thanks Diggsey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants