News for hackers. Stuff that matters.
Re:How Rust is tested by losvedir on Monday July 10, 2017 @03:13PM (#14738774)
I love the concept of the "crater run" (or I guess now "cargo bomb"?), where the entire crate (i.e. "package") ecosystem is compiled, as a test for speculative compiler changes.

It's one of the huge benefits of being both a statically-typed compiled language and offering a modern package system. A lot of languages have the types & compiling but no standard package ecosystem (Haskell, Go, Java), or the package ecosystem but not the compiling (Ruby+Gems, JS+npm, etc). Rust is the only language I can think of that has both, although I'm sure there are others. I'm not sure if there's tooling for compiler writers in other languages to compile them all, though.

And this feature will only get more and more powerful as the ecosystem grows. I think it's a seriously important tool to keep the rust language feeling stable.

Re:How Rust is tested by twic on Monday July 10, 2017 @05:19PM (#14739791)
What stops Java doing this is not that it doesn't have a "modern" package system, it's that the package system ships compiled bytecode rather than source code.

Conversely, what stops other languages with source-shipping package managers doing this is that packages don't include tests. One notable exception to this is Perl, where packages can, and typically do, include tests, and these are run as part of the normal installation process. There are even some public-spirited souls who download and test everything that gets uploaded:

http://www.cpantesters.org/

This incorporation of tests is both a consequence of and a justification for the fact that Perl inter-package dependencies aren't versioned, so you can never really be sure that you're going to download a combination that works.

Re:How Rust is tested by saghm on Monday July 10, 2017 @08:19PM (#14740704)
An interesting thing I learned recently about cpantesters is that they'll also test packages against the bleeding edge versions of the interpreter, so sometimes a package maintainer will get an issue filed (or a PR) saying "your package is going to break in about eight months", which I find both funny and cool.
Re:How Rust is tested by simcop2387 on Monday July 10, 2017 @09:34PM (#14740977)
In fact I used this for the past Perl release 5.26 to help test everything since there was a known to be breaking change that was going to occur. I need to redo.my efforts now that the release has happened but it did help identify a couple of key packages that needed to be updated
Re:How Rust is tested by moomin on Tuesday July 11, 2017 @03:26AM (#14742213)
You say it's the absence of tests, but Ruby breaks RubySpec all the time, so I think the real issue is that the maintainers plain don't care.
Re:How Rust is tested by samth on Monday July 10, 2017 @05:29PM (#14739871)
This doesn't need a statically typed language at all. Here's the same thing, with test runs, nightly, for Racket: http://pkg-build.racket-lang.org/ (that's building all packages on the current release, there's another one against the nightly snapshot).
Re:How Rust is tested by elihu on Monday July 10, 2017 @05:10PM (#14739717)
Haskell does have a community package repository (hackage) and a command for installing libraries and their dependencies (cabal).

https://hackage.haskell.org/

Re:How Rust is tested by eru on Monday July 10, 2017 @05:17PM (#14739774)
Actually, I'd say that these days stackage is the place to go for Haskell.
Re:How Rust is tested by kryptiskt on Monday July 10, 2017 @10:40PM (#14741229)
Everything flows from Hackage even if you're using Stackage.
Re:How Rust is tested by JoshTriplett on Monday July 10, 2017 @07:29PM (#14740501)
That's a very controversial question; stack is divisive, and very opinionated (as are its authors).
Re:How Rust is tested by Buttons840 on Monday July 10, 2017 @09:54PM (#14741064)
stack is just software. It's software that a large portion (maybe the majority?) of the community prefers to use. Haskell is an open source project. Someone wanted to do package management in a different way, so they put in the work and wrote the code, and it turns out a lot of people like it.

I've seen some intense debates over the merits of the two package managers, but ultimately they both have their pros and cons, and are fortunately fairly compatible.

Re:How Rust is tested by JoshTriplett on Monday July 10, 2017 @11:14PM (#14741334)
Software can be "opinionated", when it has very specific ideas about how to do things and enforces a specific workflow. That can be a good thing, if you like that workflow well enough, or a bad thing, if you don't, or if you need flexibility it doesn't provide.
Re:How Rust is tested by eru on Tuesday July 11, 2017 @05:30AM (#14742709)
Definitely. Just compare eg git, mercurial, bazaar and darcs. They can do roughly the same things these days, but have very different opinions. (And that's just their CLI. The various GUI front-ends are yet another source of opinions.)
Re:How Rust is tested by 3JPLW on Monday July 10, 2017 @03:54PM (#14739075)
You don't need a statically-typed or compiled language to have this sort of infrastructure! Julia does something similar for important changes — and it actually runs all the unit tests of all the registered packages.
Re:How Rust is tested by gsnedders on Monday July 10, 2017 @04:46PM (#14739500)
Heck, an extreme is what I did for Carakan, Opera's last in-house JS VM, where we were running the testsuite of pretty much any notable JS library in 2010 in CI; that caught loads of subtle bugs. (That said, obviously harder to automate, given there's no standard for in-browser testing!)

Far as I'm aware, every browser is running some version of the jQuery testsuite nowadays, though I doubt that's the only third-party library tested in such a way in each browser.

Re:How Rust is tested by bennofs on Monday July 10, 2017 @05:20PM (#14739801)
This technique is used to at least some extent in the Haskell world as well. Library changes are sometimes judged by the amount of breakage that they cause (often, Stackage or a subset thereof is used for these tests as a set of "commonly" used packages).

Also, Haskell definitely has a standard package system: Hackage. (Stackage is just a "view"/subset of Hackage)

Re:How Rust is tested by steveklabnik on Monday July 10, 2017 @03:42PM (#14738995)
> "crater run" (or I guess now "cargo bomb"?)

Crater is the older tool that runs builds. CargoBomb is the newer tool that runs builds and tests.

Re:How Rust is tested by mrec on Monday July 10, 2017 @03:42PM (#14739000)
Yeah, I was really impressed by that as well when it was first announced. Makes perfect sense once you hear it, but as an old fogey I just wasn't used to thinking on that kind of scale.

I had a similar lightbulb moment years ago when someone pointed out that y'know, these days it's perfectly feasible to test a simple float32 function by running every possible float32 bitpattern through it.

Re:How Rust is tested by Dylan16807 on Monday July 10, 2017 @11:36PM (#14741400)
These days? Grab a 20 year old Pentium II and you can test a 300-cycle 32-bit function in an hour.
Re:How Rust is tested by amichal on Monday July 10, 2017 @08:12PM (#14740675)
True... as long as you know what output you are expecting for all 2^32 patterns

(Not your point I know)

Re:How Rust is tested by houli on Monday July 10, 2017 @03:51PM (#14739062)
This is what Stackage(https://www.stackage.org/) LTS releases are in the Haskell world. A compiler and a large subset of the Hackage repository known to compile together and pass tests.
Re:How Rust is tested by ajdlinux on Monday July 10, 2017 @08:41PM (#14740790)
At my employer, we did some internal work on "compiling" - i.e. installing (including compiling any native extensions) and running test suites - on the entire Python, Ruby and NPM ecosystems.

Conference talk: https://www.youtube.com/watch?v=v7wSqOQeGhA

Re:How Rust is tested by akavel on Monday July 10, 2017 @04:43PM (#14739471)
AFAIK, Go devs actually do a similar thing (i.e. test the compiler on a body of selected notable third party packages/apps) [citation needed]. An official central index similar to Rust's https://crates.io for Go is https://godoc.org (though there are other non-official ones too)
Re:How Rust is tested by brson on Monday July 10, 2017 @04:50PM (#14739534)
Yes, my impression is that many production-grade compiler dev teams have technique like this, though often they do not talk much about it, often they are proprietary and/or covered by NDAs, and often they are, as you say, 'selected' code bases. I'm very curious for other compiler teams to say more about what they do here.
Re:How Rust is tested by ubernostrum on Monday July 10, 2017 @07:36PM (#14740522)
In the Python world where there are multiple viable implementations of the language, they often take large/notable packages and make those packages' test suites part of the language implementation's test suite.
Re:How Rust is tested by chii on Tuesday July 11, 2017 @07:57AM (#14743384)
> no standard package ecosystem ... Java

that's not true! The standard "package" ecosystem in java is maven, and the maven repository!