Commit graph

297 commits

Author SHA1 Message Date
Nathan Ross
5ff85de8d9 rm obsolete TODO comment 2015-12-25 19:59:10 -05:00
Nathan Ross
a5a93175fe alphabetical ordering for list of progs 2015-12-25 19:58:35 -05:00
Nathan Ross
02a04014c1 default INSTALL to list of progs 2015-12-25 03:05:21 -05:00
Heather
650c55b3a7 Merge pull request #771 from nathanross/busytest-multicall
resolve bug where newer busybox tests would not run, multicall method as suggested in #769
2015-12-25 11:21:05 +04:00
Nathan Ross
0bb971b918 return prefix var 2015-12-25 00:58:37 -05:00
Nathan Ross
23ca60ecd2 fix error in overriding build during install 2015-12-25 00:56:02 -05:00
Nathan Ross
a3196319c5 support busybox newer tests through multicall 2015-12-25 00:45:23 -05:00
Nathan Ross
5c88a52c2f destdir revert, more specific clobbering 2015-12-25 00:13:29 -05:00
Nathan Ross
d99d5c1338 fixes for linux install see notes
calling install goal overrides utility build settings with utility install settings
calling install goal defaults profile to --release
PROG_PREFIX is now applied to all utilities
modify uutils.rs to make symbolic link bins possible
binary install paths rmd first to prevent errors due to lns
simplify vars for more readable install target
other minor fixes
2015-12-24 00:13:16 -05:00
Michael Gehring
d4e0ee0cde expr: add basic tests 2015-12-22 14:10:43 +01:00
Heather
c380195f94 Merge pull request #758 from ebfe/https
make: switch download to https
2015-12-22 01:06:03 +04:00
Michael Gehring
b050f6ad78 make: switch download to https 2015-12-21 21:38:03 +01:00
Michael Gehring
7649a85e13 make: fix passing empty arguments to busybox tests 2015-12-21 21:22:36 +01:00
Michael Gehring
a385a95961 make: fix busybox script 2015-12-21 09:48:14 +01:00
Nathan Ross
a0d7910e91 add back busybox test support 2015-12-20 19:48:26 -05:00
Michael Gehring
3b7aad39bf make: add CARGOFLAGS 2015-12-18 23:03:57 +01:00
Joseph Crail
cf399faad2 Add initial tests for default values 2015-12-12 16:24:48 -05:00
Joseph Crail
d6039c1b22 Remove build for unit tests.
Currently no utility has unit tests, only integration tests.
2015-12-06 22:49:56 -05:00
Joseph Crail
2c8ebb6215 Mark chmod as Unix-only until better Win support. 2015-12-01 01:33:38 -05:00
Michael Gehring
2f4ae615ed comm: add basic tests 2015-11-28 20:51:11 +01:00
Joseph Crail
d4e0ea41a3 Fix namespace collision for test.
To avoid linking issues with Rust's libtest, the crate for the test
utility was changed to 'uutest'. However, the user doesn't need to see
this so a few hoops were jumped through to make this transparent.

I also updated the make rules to build the individual features first and
then uutils. This makes 'make && make test' look more organized.
2015-11-27 01:54:18 -05:00
Joseph Crail
7ef6bdbe81 Compile only against needed dependencies. 2015-11-26 17:51:31 -05:00
Joseph Crail
927049548c Clean up whitespace and remove unused aliases. 2015-11-26 17:13:41 -05:00
Joseph Crail
340ad317e1 Remove syntax error from build. 2015-11-26 17:02:55 -05:00
Joseph Crail
2d41e6641c Set build/test make rules to be fail fast. 2015-11-25 17:33:07 -05:00
Joseph Crail
089d15c4ca Remove non-fail-fast build and test rules. 2015-11-25 17:32:02 -05:00
Joseph Crail
412025b45a Fix whitespace and sort order of tests. 2015-11-25 04:05:12 -05:00
Joseph Crail
c0c8d3ecec Fix test scaffolding after Cargo updates. 2015-11-25 01:50:57 -05:00
Nathan Ross
502957dc3e use cargo idioms to manage dependency resolution and compilation 2015-11-23 02:04:15 -05:00
Nathan Ross
a21c54e2cd rewrite tests for cargo compat, decoupled directory, output handling 2015-11-23 02:04:15 -05:00
Joseph Crail
10a2c5c224 Add tests for link. 2015-11-02 01:13:34 -05:00
Joseph Crail
3b5c776675 Add tests for rmdir.
I also adjusted error message to conform to GNU implementation.
2015-11-01 15:31:48 -05:00
Roman Gafiyatullin
092e4d1ed4 Implement expr.
Implemented as follows:

    Usage: expr EXPRESSION
      or:  expr OPTION

          --help     display this help and exit
          --version  output version information and exit

    Print the value of EXPRESSION to standard output.  A blank line below
    separates increasing precedence groups.  EXPRESSION may be:

      ARG1 | ARG2       ARG1 if it is neither null nor 0, otherwise ARG2

      ARG1 & ARG2       ARG1 if neither argument is null or 0, otherwise 0

      ARG1 < ARG2       ARG1 is less than ARG2
      ARG1 <= ARG2      ARG1 is less than or equal to ARG2
      ARG1 = ARG2       ARG1 is equal to ARG2
      ARG1 != ARG2      ARG1 is unequal to ARG2
      ARG1 >= ARG2      ARG1 is greater than or equal to ARG2
      ARG1 > ARG2       ARG1 is greater than ARG2

      ARG1 + ARG2       arithmetic sum of ARG1 and ARG2
      ARG1 - ARG2       arithmetic difference of ARG1 and ARG2

      ARG1 * ARG2       arithmetic product of ARG1 and ARG2
      ARG1 / ARG2       arithmetic quotient of ARG1 divided by ARG2
      ARG1 % ARG2       arithmetic remainder of ARG1 divided by ARG2

      STRING : REGEXP   [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING

      match STRING REGEXP        [NOT IMPLEMENTED] same as STRING : REGEXP
      substr STRING POS LENGTH   [NOT IMPLEMENTED] substring of STRING, POS counted from 1
      index STRING CHARS         [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
      length STRING              [NOT IMPLEMENTED] length of STRING
      + TOKEN                    interpret TOKEN as a string, even if it is a
                                   keyword like 'match' or an operator like '/'

      ( EXPRESSION )             value of EXPRESSION

    Beware that many operators need to be escaped or quoted for shells.
    Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
    Pattern matches return the string matched between \( and \) or null; if
    \( and \) are not used, they return the number of characters matched or 0.

    Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
    or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.

    Environment variables:
    	* EXPR_DEBUG_TOKENS=1   dump expression's tokens
    	* EXPR_DEBUG_RPN=1      dump expression represented in reverse polish notation
    	* EXPR_DEBUG_SYA_STEP=1 dump each parser step
    	* EXPR_DEBUG_AST=1      dump expression represented abstract syntax tree
2015-10-09 12:31:25 +03:00
Carlos Liam
87d14978e9 Clean whitespace
Remove leading newlines and replace lines containing only whitespace
with empty lines
2015-10-06 12:04:46 -04:00
Gustavo Hexsel
f8df842dfb Moved code officially to run on nightly since it's a dependency 2015-08-26 12:50:07 -04:00
Joseph Crail
04014d314c Add tests for cksum/sum. 2015-08-13 21:08:31 -07:00
Joseph Crail
cc4cf6049e Add tests for touch. 2015-08-11 21:45:11 -04:00
Joseph Crail
929474040b Add tests for cut. 2015-07-31 00:14:58 -04:00
Peter Atashian
47f82f0de2 Various Windows fixes
Improve handling of unicode on Windows
Disable a few crates on Windows that abuse unix APIs too much

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-19 20:25:48 -04:00
Joseph Crail
6ef7f98f26 Delay resolution of library symbols until runtime.
This is needed for dynamic libraries on OS X. This was supposed to be
part of #647, but it was left out.
2015-07-09 18:39:46 -04:00
Alex Lyon
8f6d13df5f Merge pull request #647 from jbcrail/fix-osx-stdbuf
Fix OS X build errors for stdbuf.
2015-07-09 14:58:07 -07:00
Joseph Crail
b8ab2c125f Fix stdbuf regression.
When replacing range_inclusive(), I introduced a bug when parsing
arguments. I added a smoke test to prevent basic regressions in the
future.
2015-07-09 15:23:14 -04:00
Joseph Crail
3fa2e89a7a Fix OS X build errors for stdbuf.
I removed unused linker flags, added platform-specific linker flags, and
used DYLD_LIBRARY_PATH (instead of DYLD_INSERT_LIBRARIES) for loading
the dynamic library. I also removed an unused variable mutation.
2015-07-09 13:04:04 -04:00
Joseph Crail
9f1dc98925 Add initial implementation for ln.
There are several areas needing improvement:

1) add tests for hard links
2) add implementation for uncommon flags (-d, -L, -n, -P, -r)
3) align error messages more closely with GNU implementation
2015-07-05 14:52:31 -04:00
Joseph Crail
dcfc23498e Add tests for tac. 2015-06-06 22:33:56 -04:00
Joseph Crail
23cb9541e7 Add initial tests for realpath. 2015-06-04 00:04:37 -04:00
Joseph Crail
2dd90af92a Add initial tests. 2015-06-03 01:41:56 -04:00
Joseph Crail
133a6c5563 Add initial tests for head. 2015-05-30 19:10:15 -04:00
dokaptur
5aa68eb716 printing version unified and tests 2015-05-30 13:48:53 +02:00
dokaptur
ea7df03c0a initial ptx commit 2015-05-30 09:35:28 +02:00
Joseph Crail
2bde7872c5 Add tests for base64. 2015-05-28 23:25:13 -04:00
Joseph Crail
b4b08de42c Switch to external getopts cargo (part 1).
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.

I'm splitting the updates into several commits for better reviewing.
2015-05-20 22:47:30 -04:00
Joseph Crail
9d74bbe532 Add initial tests for hashsum. 2015-05-16 18:03:09 -04:00
Heather
3cc357e118 Merge pull request #601 from kwantam/master
improved Sieve implementation ; add `cargo update`
2015-05-16 08:25:23 +03:00
Joseph Crail
906ba3e24a Add tests for unlink. 2015-05-15 20:11:54 -04:00
kwantam
e1dac4695e improved Sieve implementation ; add cargo update
This commit adds `cargo update` to the distclean target in the
makefile. This updates the Cargo.lock file when clearing the
deps directory.

In addition, it adds a faster implementation of the Sieve of
Eratosthenes for use by `src/factor/gen_table.rs` and `test/factor.rs`.
2015-05-15 19:39:43 -04:00
Joseph Crail
497c04ad44 Add tests for rm. 2015-05-15 19:14:42 -04:00
Joseph Crail
481fdd744a Add tests for readlink. 2015-05-12 17:09:41 -04:00
Joseph Crail
82dbd02c03 Add initial test for tsort. 2015-05-09 23:38:48 -04:00
Heather
1f67aaaf8c Merge pull request #585 from jbcrail/add-basename-split-tests
Add initial tests for basename/split.
2015-05-09 22:20:23 +03:00
Joseph Crail
08aea6d549 Add initial test for pwd. 2015-05-09 15:17:26 -04:00
Joseph Crail
9172bb9bd8 Add initial tests for false/true. 2015-05-09 15:17:16 -04:00
Joseph Crail
87e7cc9b44 Add initial tests for echo. 2015-05-09 15:17:01 -04:00
Joseph Crail
e700e0d2f4 Add initial tests for dirname. 2015-05-09 15:16:45 -04:00
Joseph Crail
646285f684 Add initial tests for basename. 2015-05-09 13:32:47 -04:00
Joseph Crail
234c81311f Add initial tests for split.
I created random data to test several cases. I verified that the data is
split into the correct number of files and can also be reassembled into
the original file.
2015-05-09 13:32:30 -04:00
Joseph Crail
5878d9904e Add tests for fold. 2015-05-08 00:58:43 -04:00
kwantam
ff24d48e73 modify factor impl to eliminate overflow issue
This change does the following:

1. Updates the arithmetic functions in `src/factor/numeric.rs` to
   correctly handle all cases up to 2^64. When numbers are larger
   than 2^63, we fall back to slightly slower routines that check
   for and handle overflow.

2. Since the arithmetic functions will now not overflow, we no longer
   need the safety net trial division implementation. We now always
   use Pollard's rho after eliminating small (<=13 bit) primes.

3. Slight tweak in `src/factor/gen_table.rs` to generate the first
   1027 primes, which means we test every prime of 13 or fewer bits
   before going into Pollard's rho. Includes corresponding update in
   `src/factor/prime_table.rs` and the Makefile to reflect this.

4. Add a new test that generates random numbers with exclusively
   large (14 to 50 bit) prime factors. This exercises the possible
   overflow paths.

5. Add another new test that checks the `is_prime()` function against
   a few dozen 64-bit primes. Again this is to exercise possible
   overflow paths.
2015-05-08 00:06:35 -04:00
kwantam
9a806346a9 add test for factor
Add a test for `factor`.

This commit also pulls factor's Sieve implementation into its own module
so that the factor test can use it.

Finally, slight refactoring for clarity in gen_table.rs.
2015-05-07 18:13:39 -04:00
kwantam
6c4e967fc6 fix and slight optimization for factor
This commit builds upon @wikol's Pollard rho implementation.
It adds the following:

1. A generator for prime inverse tables. With these, we can do
   very fast divisibility tests (a single multiply and comparison)
   for small primes (presently, the first 1000 primes are in the
   table, which means all numbers of ~26 bits or less can be
   factored very quickly.

2. Always try prime inverse tables before jumping into Pollard's
   rho method or using trial division.

3. Since we have eliminated all small factors by the time we're
   done with the table division, only use slow trial division when
   the number is big enough to cause overflow issues in Pollard's
   rho, and jump out of trial division and into Pollard's rho as
   soon as the number is small enough.

4. Updates the Makefile to regenerate the prime table if it's not
   up-to-date.
2015-05-07 18:12:32 -04:00
Heather
d290c9bdfd Merge pull request #577 from jbcrail/add-test-check
Add a new makefile rule to check for test errors.
2015-05-08 00:02:07 +03:00
Joseph Crail
0736855c3d Add a new makefile rule to check for test errors.
This rule will test each program, ignore all output, and return pass or
fail depending on whether the test has errors. This is the equivalent of
"make build-check", but for tests.
2015-05-07 16:59:34 -04:00
Joseph Crail
0ea0e7504a Add test for paste. 2015-05-07 16:51:55 -04:00
Joseph Crail
5d7a7fd875 Add test support for env to Makefile. 2015-05-07 00:04:41 -04:00
Joseph Crail
5c1de087af Add a new makefile rule to check for build errors.
This rule will build each program, ignore all output, and return pass or
fail depending on whether the build has errors. This is helpful for
finding out which programs need to be fixed when a new Rust nightly
build inevitably breaks everything.
2015-04-27 01:48:03 -04:00
kwantam
d54ee9689d do not consider deps for EXESs when making goal "test"
In the normal case, one does, e.g.,
    make TEST="cat" test

This means that the value of EXES in the Makefile contains all
possible targets, which means many prerequisites that aren't
required get built.

With this change, when the `test` target is in effect (and,
in particular, *only* the test target), then the value of
EXES is ignored when calculating dependencies. Otherwise,
the values of EXES and TESTS are both considered.
2015-04-26 16:12:19 -04:00
kwantam
d4f39e1638 dependency builds use Cargo
With this change, individual submodules can specify their dependencies with
an additional file called "deps.mk" in the subdir. When building, only
the dependencies that are necessary are built, using cargo, and then linked.

This greatly simplifies adding new dependencies: add the package in
deps/Cargo.toml, and add the appropriate line in "deps.mk" in the
src/utilname/ directory, and the dependency will be built automatically
as needed.

This also removes the need to use git submodules.
2015-04-25 22:18:03 -04:00
Joseph Crail
023780ea37 Fix broken build for serialize crate.
After building the serialize crate, the rlib was copied to the build
directory using a hyphen in the library name ('librustc-serialize').
It seems that Rust expects an underscore instead.
2015-04-23 00:56:11 -04:00
kwantam
ecf248c5e3 fix build infrastructure ; modernize library use
This patch begins the work of modernizing uutils to work with 1.0-ish
Rust. In particular, it

1. Updates to the latest submodules.

2. Convert mkmain.rs, mkuutils.rs, and src/uutils/uutils.rs
   to new slice syntax and use of new io, fs, and path APIs.

3. Convert src/common/util.rs to new io, fs, and path APIs.

4. Convert fmt to use new APIs.
2015-04-18 19:55:32 -04:00
Michael Gehring
6dd6ff31b3 link against the rand crate from rust-crypto/deps 2015-02-07 10:33:00 +01:00
Michael Gehring
9c75b2ddab link against the libc from rust-crypto/deps/libc 2015-02-06 14:10:07 +01:00
Arcterus
b01f123050 Fix typo in stdbuf dependencies (fixes #521) 2015-02-01 13:08:54 -08:00
Alex Lyon
2f0d8c89c9 Merge pull request #515 from keunwoo/merge-benhirsch-od-20150125
Merge benhirsch24 work on od
2015-01-27 21:24:42 -08:00
Michael Gehring
6a9d769269 stdbuf: fix library output name 2015-01-25 13:46:07 +01:00
Alex Lyon
61e698ff9f Merge pull request #510 from ebfe/fix-build
Fix build with rust master
2015-01-25 00:28:20 -08:00
Michael Gehring
55fed599de The serialize crate shipped with rust no longer supports base64 2015-01-25 08:31:42 +01:00
Keunwoo Lee
f1436f985d Merge branch 'master' of https://github.com/benhirsch24/coreutils into benhirsch-od
Conflicts:
	Makefile
2015-01-24 23:14:57 -08:00
dokaptur
ec4182fcf1 stdbuf - install multicall 2015-01-25 00:39:30 +01:00
dokaptur
b71df2fd78 prepare_libs in Makefile 2015-01-25 00:39:30 +01:00
dokaptur
32259aadda basic version 1 2015-01-25 00:38:20 +01:00
Haitao Li
a6750e90a7 Implement readlink
Fixes #111
2015-01-13 22:21:23 +11:00
Arcterus
41cc268df8 Make dependency info usable for test, sync, true, and false 2015-01-10 13:00:15 -08:00
Arcterus
7838e839aa Remove warning about dep-info being deprecated 2015-01-10 12:13:25 -08:00
Michael Gehring
c3fb3fe23f make: disable deps/time build and use rust-crypto/deps/time instead 2015-01-10 20:38:57 +01:00
Michael Gehring
1604c361b9 make: copy additional dependencies of rust-crypto 2015-01-10 20:40:38 +01:00
ebfe
2d488bf2b2 Merge pull request #493 from Arcterus/master
base64, cat: fix build for Rust alpha
2015-01-10 02:08:47 +01:00
Arcterus
a12fd89cb2 chmod, chroot, comm: fix build 2015-01-09 16:51:51 -08:00
Michael Gehring
75082b64ba make: wipe $(TEMPDIR) before running tests 2015-01-09 14:20:36 +01:00
Michael Gehring
2dcbd84456 Build rust-crypto with cargo 2015-01-08 13:08:51 +01:00
Michael Gehring
e432c267b6 '--print-file-name' -> '--print file-names' 2015-01-08 13:08:51 +01:00