diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/install_spec.lua | 26 | ||||
-rw-r--r-- | spec/quick/install.q | 211 | ||||
-rw-r--r-- | spec/util/quick.lua | 2 |
3 files changed, 212 insertions, 27 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index df70ed23..e6b1ad03 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
@@ -13,8 +13,6 @@ local extra_rocks = { | |||
13 | "/luassert-1.7.0-1.src.rock", | 13 | "/luassert-1.7.0-1.src.rock", |
14 | "/luasocket-${LUASOCKET}.src.rock", | 14 | "/luasocket-${LUASOCKET}.src.rock", |
15 | "/lxsh-${LXSH}.src.rock", | 15 | "/lxsh-${LXSH}.src.rock", |
16 | "/say-1.2-1.src.rock", | ||
17 | "/say-1.0-1.src.rock", | ||
18 | "/luafilesystem-${LUAFILESYSTEM}.src.rock", | 16 | "/luafilesystem-${LUAFILESYSTEM}.src.rock", |
19 | "/luafilesystem-${LUAFILESYSTEM_OLD}.src.rock", | 17 | "/luafilesystem-${LUAFILESYSTEM_OLD}.src.rock", |
20 | "spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock", | 18 | "spec/fixtures/a_repo/has_build_dep-1.0-1.all.rock", |
@@ -155,30 +153,6 @@ describe("luarocks install #integration", function() | |||
155 | end) | 153 | end) |
156 | end) | 154 | end) |
157 | 155 | ||
158 | describe("New install functionality based on pull request 552", function() | ||
159 | it("break dependencies warning", function() | ||
160 | assert.is_true(run.luarocks_bool("install say 1.2")) | ||
161 | assert.is_true(run.luarocks_bool("install luassert")) | ||
162 | assert.is_true(run.luarocks_bool("install say 1.0")) | ||
163 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) | ||
164 | end) | ||
165 | it("break dependencies force", function() | ||
166 | assert.is_true(run.luarocks_bool("install say 1.2")) | ||
167 | assert.is_true(run.luarocks_bool("install luassert")) | ||
168 | local output = run.luarocks("install --force say 1.0") | ||
169 | assert.is.truthy(output:find("Checking stability of dependencies")) | ||
170 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) | ||
171 | end) | ||
172 | it("break dependencies force fast", function() | ||
173 | assert.is_true(run.luarocks_bool("install say 1.2")) | ||
174 | assert.is_true(run.luarocks_bool("install luassert")) | ||
175 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.2-1")) | ||
176 | local output = run.luarocks("install --force-fast say 1.0") | ||
177 | assert.is.falsy(output:find("Checking stability of dependencies")) | ||
178 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/say/1.0-1")) | ||
179 | end) | ||
180 | end) | ||
181 | |||
182 | describe("#build_dependencies", function() | 156 | describe("#build_dependencies", function() |
183 | it("install does not install a build dependency", function() | 157 | it("install does not install a build dependency", function() |
184 | assert(run.luarocks_bool("install has_build_dep")) | 158 | assert(run.luarocks_bool("install has_build_dep")) |
diff --git a/spec/quick/install.q b/spec/quick/install.q index 31544470..e2df4283 100644 --- a/spec/quick/install.q +++ b/spec/quick/install.q | |||
@@ -475,3 +475,214 @@ RUN: luarocks install ./myrock-1.0-1.all.rock | |||
475 | 475 | ||
476 | EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/folder/rock.lua | 476 | EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/folder/rock.lua |
477 | EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/xyz.lua | 477 | EXISTS: %{testing_sys_tree}/share/lua/%{lua_version}/xyz.lua |
478 | |||
479 | |||
480 | |||
481 | ================================================================================ | ||
482 | TEST: new install functionality based on #552: break dependencies warning | ||
483 | |||
484 | FILE: myrock-1.0-1.rockspec | ||
485 | -------------------------------------------------------------------------------- | ||
486 | rockspec_format = "3.0" | ||
487 | package = "myrock" | ||
488 | version = "1.0-1" | ||
489 | source = { | ||
490 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
491 | } | ||
492 | build = { | ||
493 | modules = { rock = "rock.lua" } | ||
494 | } | ||
495 | -------------------------------------------------------------------------------- | ||
496 | |||
497 | FILE: myrock-2.0-1.rockspec | ||
498 | -------------------------------------------------------------------------------- | ||
499 | rockspec_format = "3.0" | ||
500 | package = "myrock" | ||
501 | version = "2.0-1" | ||
502 | source = { | ||
503 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
504 | } | ||
505 | build = { | ||
506 | modules = { rock = "rock.lua" } | ||
507 | } | ||
508 | -------------------------------------------------------------------------------- | ||
509 | |||
510 | FILE: hasdep-1.0-1.rockspec | ||
511 | -------------------------------------------------------------------------------- | ||
512 | rockspec_format = "3.0" | ||
513 | package = "hasdep" | ||
514 | version = "1.0-1" | ||
515 | source = { | ||
516 | url = "file://%{url(%{tmpdir})}/hasdep.lua" | ||
517 | } | ||
518 | dependencies = { | ||
519 | "myrock >= 2.0", | ||
520 | } | ||
521 | build = { | ||
522 | modules = { hasdep = "hasdep.lua" } | ||
523 | } | ||
524 | -------------------------------------------------------------------------------- | ||
525 | |||
526 | FILE: rock.lua | ||
527 | -------------------------------------------------------------------------------- | ||
528 | return "hello" | ||
529 | -------------------------------------------------------------------------------- | ||
530 | |||
531 | FILE: hasdep.lua | ||
532 | -------------------------------------------------------------------------------- | ||
533 | return "hasdep" | ||
534 | -------------------------------------------------------------------------------- | ||
535 | |||
536 | RUN: luarocks build myrock-2.0-1.rockspec | ||
537 | RUN: luarocks build hasdep-1.0-1.rockspec | ||
538 | RUN: luarocks build myrock-1.0-1.rockspec | ||
539 | |||
540 | STDERR: | ||
541 | -------------------------------------------------------------------------------- | ||
542 | Will not remove myrock 2.0 | ||
543 | Removing it would break dependencies for | ||
544 | hasdep 1.0 | ||
545 | -------------------------------------------------------------------------------- | ||
546 | |||
547 | EXISTS: %{testing_sys_rocks}/myrock/1.0-1 | ||
548 | EXISTS: %{testing_sys_rocks}/myrock/2.0-1 | ||
549 | |||
550 | |||
551 | |||
552 | ================================================================================ | ||
553 | TEST: new install functionality based on #552: break dependencies with --force | ||
554 | |||
555 | FILE: myrock-1.0-1.rockspec | ||
556 | -------------------------------------------------------------------------------- | ||
557 | rockspec_format = "3.0" | ||
558 | package = "myrock" | ||
559 | version = "1.0-1" | ||
560 | source = { | ||
561 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
562 | } | ||
563 | build = { | ||
564 | modules = { rock = "rock.lua" } | ||
565 | } | ||
566 | -------------------------------------------------------------------------------- | ||
567 | |||
568 | FILE: myrock-2.0-1.rockspec | ||
569 | -------------------------------------------------------------------------------- | ||
570 | rockspec_format = "3.0" | ||
571 | package = "myrock" | ||
572 | version = "2.0-1" | ||
573 | source = { | ||
574 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
575 | } | ||
576 | build = { | ||
577 | modules = { rock = "rock.lua" } | ||
578 | } | ||
579 | -------------------------------------------------------------------------------- | ||
580 | |||
581 | FILE: hasdep-1.0-1.rockspec | ||
582 | -------------------------------------------------------------------------------- | ||
583 | rockspec_format = "3.0" | ||
584 | package = "hasdep" | ||
585 | version = "1.0-1" | ||
586 | source = { | ||
587 | url = "file://%{url(%{tmpdir})}/hasdep.lua" | ||
588 | } | ||
589 | dependencies = { | ||
590 | "myrock >= 2.0", | ||
591 | } | ||
592 | build = { | ||
593 | modules = { hasdep = "hasdep.lua" } | ||
594 | } | ||
595 | -------------------------------------------------------------------------------- | ||
596 | |||
597 | FILE: rock.lua | ||
598 | -------------------------------------------------------------------------------- | ||
599 | return "hello" | ||
600 | -------------------------------------------------------------------------------- | ||
601 | |||
602 | FILE: hasdep.lua | ||
603 | -------------------------------------------------------------------------------- | ||
604 | return "hasdep" | ||
605 | -------------------------------------------------------------------------------- | ||
606 | |||
607 | RUN: luarocks build myrock-2.0-1.rockspec | ||
608 | RUN: luarocks build hasdep-1.0-1.rockspec | ||
609 | RUN: luarocks build myrock-1.0-1.rockspec --force | ||
610 | |||
611 | STDERR: | ||
612 | -------------------------------------------------------------------------------- | ||
613 | The following packages may be broken by this forced removal | ||
614 | hasdep 1.0 | ||
615 | -------------------------------------------------------------------------------- | ||
616 | |||
617 | NOT_EXISTS: %{testing_sys_rocks}/myrock/2.0-1 | ||
618 | EXISTS: %{testing_sys_rocks}/myrock/1.0-1 | ||
619 | |||
620 | |||
621 | |||
622 | ================================================================================ | ||
623 | TEST: new install functionality based on #552: break dependencies with --force-fast | ||
624 | |||
625 | FILE: myrock-1.0-1.rockspec | ||
626 | -------------------------------------------------------------------------------- | ||
627 | rockspec_format = "3.0" | ||
628 | package = "myrock" | ||
629 | version = "1.0-1" | ||
630 | source = { | ||
631 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
632 | } | ||
633 | build = { | ||
634 | modules = { rock = "rock.lua" } | ||
635 | } | ||
636 | -------------------------------------------------------------------------------- | ||
637 | |||
638 | FILE: myrock-2.0-1.rockspec | ||
639 | -------------------------------------------------------------------------------- | ||
640 | rockspec_format = "3.0" | ||
641 | package = "myrock" | ||
642 | version = "2.0-1" | ||
643 | source = { | ||
644 | url = "file://%{url(%{tmpdir})}/rock.lua" | ||
645 | } | ||
646 | build = { | ||
647 | modules = { rock = "rock.lua" } | ||
648 | } | ||
649 | -------------------------------------------------------------------------------- | ||
650 | |||
651 | FILE: hasdep-1.0-1.rockspec | ||
652 | -------------------------------------------------------------------------------- | ||
653 | rockspec_format = "3.0" | ||
654 | package = "hasdep" | ||
655 | version = "1.0-1" | ||
656 | source = { | ||
657 | url = "file://%{url(%{tmpdir})}/hasdep.lua" | ||
658 | } | ||
659 | dependencies = { | ||
660 | "myrock >= 2.0", | ||
661 | } | ||
662 | build = { | ||
663 | modules = { hasdep = "hasdep.lua" } | ||
664 | } | ||
665 | -------------------------------------------------------------------------------- | ||
666 | |||
667 | FILE: rock.lua | ||
668 | -------------------------------------------------------------------------------- | ||
669 | return "hello" | ||
670 | -------------------------------------------------------------------------------- | ||
671 | |||
672 | FILE: hasdep.lua | ||
673 | -------------------------------------------------------------------------------- | ||
674 | return "hasdep" | ||
675 | -------------------------------------------------------------------------------- | ||
676 | |||
677 | RUN: luarocks build myrock-2.0-1.rockspec | ||
678 | RUN: luarocks build hasdep-1.0-1.rockspec | ||
679 | RUN: luarocks build myrock-1.0-1.rockspec --force-fast | ||
680 | |||
681 | NOT_STDERR: | ||
682 | -------------------------------------------------------------------------------- | ||
683 | The following packages may be broken by this forced removal | ||
684 | hasdep 1.0 | ||
685 | -------------------------------------------------------------------------------- | ||
686 | |||
687 | NOT_EXISTS: %{testing_sys_rocks}/myrock/2.0-1 | ||
688 | EXISTS: %{testing_sys_rocks}/myrock/1.0-1 | ||
diff --git a/spec/util/quick.lua b/spec/util/quick.lua index 257f570e..b2683ac6 100644 --- a/spec/util/quick.lua +++ b/spec/util/quick.lua | |||
@@ -468,7 +468,7 @@ function quick.compile(filename, env) | |||
468 | for i, line in ipairs(op.not_stderr.data) do | 468 | for i, line in ipairs(op.not_stderr.data) do |
469 | write(([=[ line = %q ]=]):format(line)) | 469 | write(([=[ line = %q ]=]):format(line)) |
470 | write(([=[ s = string.find(stderr_data, line, block_at, true) ]=])) | 470 | write(([=[ s = string.find(stderr_data, line, block_at, true) ]=])) |
471 | write(([=[ assert(not s, error_message(%d, "NOT_STDERR did match unwanted output: " .. line, stderr_data)) ]=]):format(op.stderr.start + i)) | 471 | write(([=[ assert(not s, error_message(%d, "NOT_STDERR did match unwanted output: " .. line, stderr_data)) ]=]):format(op.not_stderr.start + i)) |
472 | end | 472 | end |
473 | write([=[ end ]=]) | 473 | write([=[ end ]=]) |
474 | end | 474 | end |