|
2 | 2 | // |
3 | 3 | // For the full copyright and license information, please view the LICENSE |
4 | 4 | // file that was distributed with this source code. |
5 | | -// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm abcdefghi nabcde nabcdefg abcdefg fifoname seekable fadvise FADV DONTNEED |
| 5 | +// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, availible, behaviour, bmax, bremain, btotal, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rposition, rremain, rsofar, rstat, sigusr, sigval, wlen, wstat abcdefghijklm abcdefghi nabcde nabcdefg abcdefg fifoname seekable |
6 | 6 |
|
7 | 7 | use uutests::at_and_ucmd; |
8 | 8 | use uutests::new_ucmd; |
@@ -1781,6 +1781,41 @@ fn test_wrong_number_err_msg() { |
1781 | 1781 | .stderr_contains("dd: invalid number: '1kBb555'\n"); |
1782 | 1782 | } |
1783 | 1783 |
|
| 1784 | +#[test] |
| 1785 | +#[cfg(all( |
| 1786 | + unix, |
| 1787 | + not(target_os = "macos"), |
| 1788 | + not(target_os = "freebsd"), |
| 1789 | + feature = "printf" |
| 1790 | +))] |
| 1791 | +fn test_no_dropped_writes() { |
| 1792 | + const BLK_SIZE: usize = 0x4000; |
| 1793 | + const COUNT: usize = 1000; |
| 1794 | + const NUM_BYTES: usize = BLK_SIZE * COUNT; |
| 1795 | + |
| 1796 | + let mut reader_command = Command::new(get_tests_binary()); |
| 1797 | + let child = reader_command |
| 1798 | + .args(&[ |
| 1799 | + "dd", |
| 1800 | + "if=/dev/urandom", |
| 1801 | + &format!("bs={}", BLK_SIZE), |
| 1802 | + &format!("count={}", COUNT), |
| 1803 | + ]) |
| 1804 | + .stdout(Stdio::piped()) |
| 1805 | + .stderr(Stdio::piped()) |
| 1806 | + .env("LC_ALL", "C") |
| 1807 | + .spawn() |
| 1808 | + .unwrap(); |
| 1809 | + |
| 1810 | + let output = child.wait_with_output().unwrap(); |
| 1811 | + assert_eq!(output.stdout.len(), NUM_BYTES); |
| 1812 | + assert!( |
| 1813 | + str::from_utf8(&output.stderr) |
| 1814 | + .unwrap() |
| 1815 | + .contains(&format!("{} bytes", NUM_BYTES)) |
| 1816 | + ); |
| 1817 | +} |
| 1818 | + |
1784 | 1819 | #[test] |
1785 | 1820 | #[cfg(any(target_os = "linux", target_os = "android"))] |
1786 | 1821 | fn test_oflag_direct_partial_block() { |
|
0 commit comments